【发布时间】:2017-12-28 17:23:31
【问题描述】:
如何将此方法从 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))
}
【讨论】: