我正在嘗試計算 sha1,但 sha1 與 openssl 命令不匹配。我在 Macbook 上像這樣計算空文件的哈希值:$ touch test.txt$ openssl sha1 -hex test.txtSHA1(test.txt)= da39a3ee5e6b4b0d3255bfef95601890afd80709而這里是一個簡單的測試代碼,我有:package mainimport "fmt"import "crypto/sha1"func main() { hash := sha1.New() hash.Write([]byte{0x00}) fmt.Printf("Hash got %x, expected da39a3ee5e6b4b0d3255bfef95601890afd80709", hash.Sum(nil))}這是您看到輸出不匹配的輸出,有人知道我做錯了什么嗎?Hash got 5ba93c9db0cff93f52b521d7420e43f6eda2784f, expected da39a3ee5e6b4b0d3255bfef95601890afd80709
- 1 回答
- 0 關(guān)注
- 283 瀏覽
添加回答
舉報
0/150
提交
取消