【发布时间】:2019-12-10 16:51:26
【问题描述】:
我需要将此 C# 代码转换为 QT C++:
SHA1 sha1 = new SHA1CryptoServiceProvider();
byte[] resultSha1 = sha1.ComputeHash(Encoding.Default.GetBytes(PASS));
PASS = (BitConverter.ToString(resultSha1).Replace("-", string.Empty)).ToLower();
我尝试使用它,但输出与所需的相差甚远:
sha1 = new QCryptographicHash(QCryptographicHash::Sha1);
resultSha1 = sha1->hash(userPASS.toUtf8(), QCryptographicHash::Sha1);
userPASS = QString(resultSha1).replace("-", "");
您对正确执行此操作有何建议?
【问题讨论】: