We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After hashing via MD5, SHA256 returns wrong results. Example:
var file = "C:\\Games\\StarCraft II\\SC2Data\\data\\data.008"; var stream = File.Open(file, FileMode.Open); var startTime = DateTime.Now; var hashMd5 = MD5.Create().ComputeHash(stream);// hashing MD5 var end = DateTime.Now - startTime; WriteLine($"Md5 hash time - {end}, hash = {Convert.ToBase64String(hashMd5)}"); // ~15 sec. var hashSha256 = SHA256.Create().ComputeHash(stream);//~ 0.5 end = DateTime.Now - startTime; WriteLine($"SHA256 hash time - {end}, hash = {Convert.ToBase64String(hashSha256)}"); //returns wrong hash var hashSha512 = SHA512.Create().ComputeHash(stream); // it is too end = DateTime.Now - startTime; WriteLine($"SHA512 hash time - {end}, hash = {Convert.ToBase64String(hashSha512)}");
The example returns results after 15 seconds average, but why SHA256 returns result after ~ 0.5 sec. There is a correct hash:
var file = "C:\\Games\\StarCraft II\\SC2Data\\data\\data.008"; var stream = File.Open(file, FileMode.Open); var startTime = DateTime.Now; var hashSha512 = SHA512.Create().ComputeHash(stream);//hashing 1:30 min. var end = DateTime.Now - startTime; WriteLine($"SHA512 hash time - {end}, hash = {Convert.ToBase64String(hashSha512)}");//returns correct hash
Thanks.
The text was updated successfully, but these errors were encountered:
You're not resetting the stream back to the beginning, so the first hash hashes the file, and the next ones have no data to hash.
Sorry, something went wrong.
oh, thanks. It's works. I don't know, why i didn't it...
No branches or pull requests
After hashing via MD5, SHA256 returns wrong results.
Example:
The example returns results after 15 seconds average, but why SHA256 returns result after ~ 0.5 sec.
There is a correct hash:
Thanks.
The text was updated successfully, but these errors were encountered: