Created
March 20, 2014 03:21
-
-
Save hubsgz/9656543 to your computer and use it in GitHub Desktop.
golang md5加密
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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