INNER CODE UNIT · C++
prime2
QuasarApp/Qt-Secret · src/Qt-RSA/qrsaencryption.cpp:171
prime2 = toPrime(genesisInt(hash.right(hash.size() / 2), _rsa / 2));
}
QRSAEncryption::INT QRSAEncryption::genesisInt(const QByteArray &genesis, int limitBits) const {
INT result;
auto hash = QCryptographicHash::hash(genesis, QCryptographicHash::Sha512);
result.fromHex(hash.toHex().toStdString());
int powP1 = std::max(static_cast<int>(std::trunc((limitBits) / result.sizeBits())), 1);
result.pow(powP1);
INT limit('1', limitBits, 2);
return result % limit;
}
QRSAEncryption::QRSAEncryption(Rsa rsa) {
_rsa = rsa;