Ruby 1.9.3摘要::Golang中的SHA1.hexdigest等价物

Ruby 1.9.3摘要::Golang中的SHA1.hexdigest等价物,ruby,go,hex,sha1,Ruby,Go,Hex,Sha1,如何将这个方法从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",

如何将这个方法从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))
}