Skip to content

Instantly share code, notes, and snippets.

@hubsgz
Created March 20, 2014 03:21
Show Gist options
  • Save hubsgz/9656543 to your computer and use it in GitHub Desktop.
Save hubsgz/9656543 to your computer and use it in GitHub Desktop.
golang md5加密
package main
import (
"crypto/md5"
"encoding/hex"
"fmt"
)
func main() {
h := md5.New()
h.Write([]byte("123456")) // 需要加密的字符串为 123456
fmt.Printf("%s\n", hex.EncodeToString(h.Sum(nil))) // 输出加密结果
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment