golang:
package main
import (
"crypto/sha1"
"fmt"
"io"
)
func main() {
h := sha1.New()
io.WriteString(h, "hello")
fmt.Println(h.Sum(nil))
}
==================
php :

结果不同
why ?
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
Go的代码有点问题,你需要使用%x来强制使用16进制输出。
比如: