I'm trying to compute sha1, but the sha1 is not matching with the openssl command.
I compute the hash for an empty file like so on my Macbook :
$ touch test.txt
$ openssl sha1 -hex test.txt
SHA1(test.txt)= da39a3ee5e6b4b0d3255bfef95601890afd80709
And here is the simple test code I have :
package main
import "fmt"
import "crypto/sha1"
func main() {
hash := sha1.New()
hash.Write([]byte{0x00})
fmt.Printf("Hash got %x, expected da39a3ee5e6b4b0d3255bfef95601890afd80709", hash.Sum(nil))
}
Here is the output as you see the output does not match, anyone know what I'm doing wrong?
Hash got 5ba93c9db0cff93f52b521d7420e43f6eda2784f, expected da39a3ee5e6b4b0d3255bfef95601890afd80709