opensslを使用してファイルのハッシュを生成したいと思います。
CFile file;
CFileException fileException;
file.open(filename, CFile::modeRead, &fileException);
file.SeekToBegin();
unsigned char buffer[1024];
SHA_CTX context;
SHA1_Init(&context);
while(unsigned int bytesRead = file.Read(buffer, sizeof(buffer)) > 0)
{
SHA1_Update(&context, buffer, bytesRead);
}
unsigned char hash[SHA_DIGEST_LENGTH];
SHA1_Final(hash, &context);
動作しているように見えますが、チャンクサイズを変更すると、ハッシュで異なる結果が得られます。ここで何が問題になっていますか?
挨拶