I am trying to build a base64 encoded sha1 hash in go but the result i am getting is very different to the results of other programming languages
package main
import (
"crypto/sha1"
"encoding/base64"
"fmt"
)
func main() {
c := sha1.New()
input := []byte("hello")
myBytes := c.Sum(input)
fmt.Println(base64.StdEncoding.EncodeToString(base64.StdPadding))
}
This Go Code prints out aGVsbG/aOaPuXmtLDTJVv++VYBiQr9gHCQ==
My Python Code Looks like this
import hashlib
import base64
print(base64.b64encode(hashlib.sha1('hello').digest()))
And outputs qvTGHdzF6KLavt4PO0gs2a6pQ00=
My bash command for comparison looks like this
echo -n hello| openssl dgst -sha1 -binary |base64
And outputs this qvTGHdzF6KLavt4PO0gs2a6pQ00=
Which lets me assume that the python code is doing everything correct. But why does go prints another result. Where is my mistake?
Thnx in advance