With the same byte array, the result of performing a checksum using .NET Core 3.0's SHA512Managed class is different than the result of using the built-in shasum app in MacOS.
I've triple-checked the byte array is unmodified/identical by iterating over every byte position using File.ReadAllBytes().
Process in code:
var stream = asm.GetManifestResourceStream(resourceName);
var data = new byte[stream.Length];
stream.Read(data, 0, (int)stream.Length);
var sha = new SHA512Managed();
var checksum = sha.ComputeHash(data);
At the command line:
shasum -a512 ./myfile.dat
I'm receiving a good (expected) checksum value from the shasum utility, the iHex app from the AppStore, and the website "passwordsgenerator.net/sha512-hash-generator/".
I'm receiving a bad value from the .NET code above and from the a different website "online-convert.com". Both of which produce the identical bad result!
Is there more than one implementation of the SHA512 algorithm? Since I'm comparing byte arrays, there should be no nonsense involving character encoding, right? Is there something about compiling or reading back an embedded resource in MacOS I should know about?
Any tips or pointers would be greatly appreciated!