Why on the same machine computing the SHA-1 hash of the same file produces two completely different SHA-1 hashes in windows and inside a msysgit Git bash?
Doesn't the SHA-1 algorithm was intended to produce the same hash for the same file in all OSes?
On windows (with HashCheck):
File hello.txt
22596363b3de40b06f981fb85d82312e8c0ed511
Inside a msysgit's Git bash windows (same machine, same file):
$ git hash-object hello.txt
3b18e512dba79e4c8300dd08aeb37f8e728b8dad
Git adds a header ("blob ", the length, then null) before calculating the SHA-1. See this blog post for how to emulate the calculation outside git.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With