calculate hash of binary file containing certain b

2019-08-17 05:00发布

问题:

I'm having trouble understanding the principle/method, on how to "manually" calculate a file's hash (sha256) which consist of certain bytes.

To put into an example:

I have this binary file consisting of these bytes.

2C F2 BA A3 0E 26 5A 3B  2A 1F 01 4A 01 66 60 02

How to get following (correct) hash of the file? ea3cbd30dc6c18914d2cdafdd8bec0ff4ce5995c7b484cce3237900336abb574

回答1:

1. Convert all bytes to ASCII.

2. Hash ASCII string to get correct hash from the file.

Doing this manually is not recommended, since e.g. copy and paste, or other factors can easily distort your ASCII string. So optimally this is written within a program to calculate everything altogether.