2021-05-12 12:00:41 +00:00
|
|
|
/*
|
|
|
|
* Created by victoria on 2021-05-12.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "sce.h"
|
|
|
|
|
|
|
|
#include <QRandomGenerator>
|
|
|
|
|
2021-05-13 14:54:37 +00:00
|
|
|
#define RPAD_ALPHABET "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
|
|
|
|
|
2021-05-12 12:00:41 +00:00
|
|
|
constexpr int RPAD_MAX_LENGTH = 200;
|
|
|
|
|
|
|
|
QString QXmpp::Sce::generatePadding() {
|
2021-05-13 14:54:37 +00:00
|
|
|
QRandomGenerator random{};
|
|
|
|
QString result{};
|
|
|
|
QString alphabet{QStringLiteral(RPAD_ALPHABET)};
|
2021-05-12 12:00:41 +00:00
|
|
|
|
2021-05-13 14:54:37 +00:00
|
|
|
auto length = random.bounded(RPAD_MAX_LENGTH);
|
|
|
|
result.resize(length);
|
2021-05-12 12:00:41 +00:00
|
|
|
|
2021-05-13 14:54:37 +00:00
|
|
|
for (auto i = 0; i < length; ++i) {
|
|
|
|
result[i] = alphabet[random.bounded(alphabet.length())];
|
|
|
|
}
|
2021-05-12 12:00:41 +00:00
|
|
|
|
2021-05-13 14:54:37 +00:00
|
|
|
return result;
|
2021-05-12 12:00:41 +00:00
|
|
|
}
|