我独立学习C++,我有一个问题,我不能解决超过一周的问题.我希望你能帮助我.
我需要获取Unicode字符串的SHA1摘要(如??????),但我不知道如何做到这一点.
我尝试这样做,但它返回错误的摘要!
因为wstring('?')
它返回 - A469A61DF29A7568A6CC63318EA8741FA1CF2A7
我需要 -8dbe718ab1e0c4d75f7ab50fc9a53ec4f0528373
关心并抱歉我的英语:).
CryptoPP 5.6.2 MVC++ 2013
#include <iostream>
#include "cryptopp562\cryptlib.h"
#include "cryptopp562\sha.h"
#include "cryptopp562\hex.h"
int main() {
std::wstring string(L"?");
int bs_size = (int)string.length() * sizeof(wchar_t);
byte* bytes_string = new byte[bs_size];
int n = 0; //real bytes count
for (int i = 0; i < string.length(); i++) {
wchar_t wcharacter = string[i];
int high_byte = wcharacter & 0xFF00;
high_byte = high_byte >> 8;
int low_byte = wcharacter & 0xFF; …Run Code Online (Sandbox Code Playgroud)