文字列をハッシュして、そのハッシュをファイルの名前として使用しようとしています。
私の問題:私が遭遇したすべてのC ++ハッシャー/クリプターは、std ::stringまたはchar*をハッシュし、ハッシュされた文字列をunsigned char *として返すということですか?
そのunsignedchar*をchar*またはstd::stringに変換して、ファイルまたはファイル名に書き込めるようにするにはどうすればよいですか?または、使用するために通常の文字列に変換する必要はありませんか?
tstring hashString( tstring str )
{
// Post:
unsigned char hashStr[SHA256_DIGEST_SIZE];
std::string messageStr = str;
SHA256::getInstance()->digest( messageStr, hashStr );
//TCHAR *hashStrSigned = reinterpret_cast <TCHAR*>(hashStr);
// can I just use this hashStr to create a file? Or do I have to convert it to char* to use?
Handle newF = CreateFile( (LPTSTR)hashStr, GENERIC_ALL, 0, NULL, CREATE_ALWAYS,
0, NULL );
return tstring(hashStrSigned);
}