Why does git hash-object return a different hash than openssl sha1?
Posted
by
user657606
on Stack Overflow
See other posts from Stack Overflow
or by user657606
Published on 2011-03-13T15:50:07Z
Indexed on
2011/03/13
16:09 UTC
Read the original article
Hit count: 202
Context: I downloaded a file (Audirvana 0.7.1.zip) from code.google to my Macbook Pro (Mac OS X 10.6.6).
(current url: http://code.google.com/p/audirvana/downloads/detail?name=Audirvana%200.7.1.zip&can=2&q= )
I wanted to verify the checksum, which for that particular file is posted as 862456662a11e2f386ff0b24fdabcb4f6c1c446a (SHA-1). git hash-object
gave me a different hash, but openssl sha1
returned the expected 862456662a11e2f386ff0b24fdabcb4f6c1c446a.
The following experiment seems to rule out any possible download corruption or newline differences and to indicate that there are actually two different algorithms at play:
$ echo A > foo.txt
$ cat foo.txt
A
$ git hash-object foo.txt
f70f10e4db19068f79bc43844b49f3eece45c4e8
$ openssl sha1 foo.txt
SHA1(foo.txt)= 7d157d7c000ae27db146575c08ce30df893d3a64
What's going on?
© Stack Overflow or respective owner