Ruby 1.9.3 Digest::SHA1.Golang 中的 hexdigest 等价物
Ruby 1.9.3 Digest::SHA1.hexdigest equivalent in Golang
如何将此方法从 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))
}
如何将此方法从 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))
}