MCPcopy Create free account
hub / github.com/Adaptix-Framework/AdaptixC2 / GenerateHash

Function GenerateHash

AdaptixClient/Source/Utils/Convert.cpp:331–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329
330
331QString GenerateHash(const QString &algorithm, int length, const QString &inputString)
332{
333 QCryptographicHash::Algorithm hashAlgo;
334
335 if (algorithm == "sha1") {
336 hashAlgo = QCryptographicHash::Sha1;
337 } else {
338 hashAlgo = QCryptographicHash::Md5;
339 }
340
341 QByteArray hash = QCryptographicHash::hash(inputString.toUtf8(), hashAlgo).toHex();
342 if (length > hash.size()) {
343 length = hash.size();
344 }
345 return QString(hash.left(length));
346}

Callers 1

hashMethod · 0.85

Calls 4

hashFunction · 0.85
QStringClass · 0.50
sizeMethod · 0.45
leftMethod · 0.45

Tested by

no test coverage detected