From cd218ff692df40b0324ea6834eb4924293970de0 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Wed, 1 Sep 2010 11:58:31 +0000 Subject: unify random number generation --- src/QXmppSaslAuth.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/QXmppSaslAuth.cpp') diff --git a/src/QXmppSaslAuth.cpp b/src/QXmppSaslAuth.cpp index 6b642f13..89f4edd4 100644 --- a/src/QXmppSaslAuth.cpp +++ b/src/QXmppSaslAuth.cpp @@ -106,9 +106,7 @@ void QXmppSaslDigestMd5::setPassword(const QByteArray &password) QByteArray QXmppSaslDigestMd5::generateNonce() { - QByteArray nonce(32, 'm'); - for(int n = 0; n < nonce.size(); ++n) - nonce[n] = (char)(256.0*qrand()/(RAND_MAX+1.0)); + QByteArray nonce = generateRandomBytes(32); // The random data can the '=' char is not valid as it is a delimiter, // so to be safe, base64 the nonce -- cgit v1.2.3