I am trying to get the SHA256 hash from a selected filename. Most file downloads from trusted sites today list the SHA# signatures which you can use to verify the accuracy of the download. I wish to compare these.
I have got the MD5 hash by reading the file in chunks and processing the chunks. SHA does not appear to work this way. I have tried using Crypto.Hash with the encryption set to Crypto.Agorithm.SH256. I have tried reading the file into a memoryBlock as a Binary stream. Both methods suggested in the documentation. Neither returns any kind of expected results.
Is there a way to accomplish this without resorting to a plugin?
Thanks! This looks promising. I did a quick test to verify the returned hash looked correct, but that was with a text string, not an entire file.
Now all I need to do is figure out how to get the contents of the file into one long Memory block I can test. With MD5 I use MD5.Process, to process each individual chunk of the binary stream as I read it in. There is no method to do this with the SHA# methods. I assume I have to load the entire file in order to check it.