From 96d94e93a43a72e1f76f8a1266d2c55456d92664 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Fri, 24 Jul 2020 11:17:38 +0200 Subject: [PATCH] use qrandomgenerator --- src/librssguard/miscellaneous/textfactory.cpp | 10 ++-------- src/librssguard/network-web/oauth2service.cpp | 3 ++- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/librssguard/miscellaneous/textfactory.cpp b/src/librssguard/miscellaneous/textfactory.cpp index 36647cb90..5aa32fff0 100755 --- a/src/librssguard/miscellaneous/textfactory.cpp +++ b/src/librssguard/miscellaneous/textfactory.cpp @@ -10,11 +10,10 @@ #include #include +#include #include #include -#include - quint64 TextFactory::s_encryptionKey = 0x0; TextFactory::TextFactory() = default; @@ -163,10 +162,5 @@ quint64 TextFactory::initializeSecretEncryptionKey() { } quint64 TextFactory::generateSecretEncryptionKey() { - std::random_device rd; - std::mt19937 mt(rd()); - std::uniform_int_distribution dist(std::numeric_limits().min() + 1000000UL, - std::numeric_limits().max()); - - return dist(mt); + return QRandomGenerator64::global()->generate(); } diff --git a/src/librssguard/network-web/oauth2service.cpp b/src/librssguard/network-web/oauth2service.cpp index 0064bf62a..6278324ab 100644 --- a/src/librssguard/network-web/oauth2service.cpp +++ b/src/librssguard/network-web/oauth2service.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -45,7 +46,7 @@ Q_GLOBAL_STATIC(OAuthHttpHandler, qz_silent_acmanager) OAuth2Service::OAuth2Service(const QString& auth_url, const QString& token_url, const QString& client_id, const QString& client_secret, const QString& scope, QObject* parent) - : QObject(parent), m_id(QString::number(std::rand())), m_timerId(-1), m_redirectionHandler(new OAuthHttpHandler(this)) { + : QObject(parent), m_id(QString::number(QRandomGenerator::global()->generate())), m_timerId(-1), m_redirectionHandler(new OAuthHttpHandler(this)) { m_tokenGrantType = QSL("authorization_code"); m_tokenUrl = QUrl(token_url); m_authUrl = auth_url;