mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-22 13:40:22 +01:00
use qrandomgenerator
This commit is contained in:
parent
fe286a707f
commit
96d94e93a4
@ -10,11 +10,10 @@
|
|||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
|
#include <QRandomGenerator64>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
#include <random>
|
|
||||||
|
|
||||||
quint64 TextFactory::s_encryptionKey = 0x0;
|
quint64 TextFactory::s_encryptionKey = 0x0;
|
||||||
|
|
||||||
TextFactory::TextFactory() = default;
|
TextFactory::TextFactory() = default;
|
||||||
@ -163,10 +162,5 @@ quint64 TextFactory::initializeSecretEncryptionKey() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
quint64 TextFactory::generateSecretEncryptionKey() {
|
quint64 TextFactory::generateSecretEncryptionKey() {
|
||||||
std::random_device rd;
|
return QRandomGenerator64::global()->generate();
|
||||||
std::mt19937 mt(rd());
|
|
||||||
std::uniform_int_distribution<quint64> dist(std::numeric_limits<quint64>().min() + 1000000UL,
|
|
||||||
std::numeric_limits<quint64>().max());
|
|
||||||
|
|
||||||
return dist(mt);
|
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
|
#include <QRandomGenerator>
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
@ -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,
|
OAuth2Service::OAuth2Service(const QString& auth_url, const QString& token_url, const QString& client_id,
|
||||||
const QString& client_secret, const QString& scope, QObject* parent)
|
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_tokenGrantType = QSL("authorization_code");
|
||||||
m_tokenUrl = QUrl(token_url);
|
m_tokenUrl = QUrl(token_url);
|
||||||
m_authUrl = auth_url;
|
m_authUrl = auth_url;
|
||||||
|
Loading…
Reference in New Issue
Block a user