<分区>
如何将此方法从 Ruby 1.9.3 复制到 Golang 1.7?
require 'digest/sha2'
text = Digest::SHA1.hexdigest("Hello world")
<分区>
如何将此方法从 Ruby 1.9.3 复制到 Golang 1.7?
require 'digest/sha2'
text = Digest::SHA1.hexdigest("Hello world")
最佳答案
package main
import (
"crypto/sha1"
"fmt"
)
func main() {
s := sha1.New()
s.Write([]byte("Hello world"))
fmt.Printf("%x", s.Sum(nil))
}
关于Golang 中的 Ruby 1.9.3 Digest::SHA1.hexdigest 等价物,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48011724/