Example of encryption usage in Go language MD5

  • 2020-05-26 09:21:27
  • OfStack

This article illustrates the use of encryption in the Go language, MD5. Share with you for your reference. The specific implementation method is as follows:

import (
    "crypto/md5"
    "encoding/hex"
)
func main() {
    h := md5.New()
    h.Write([]byte("sharejs.com")) // The string that needs to be encrypted is sharejs.com
    fmt.Printf("%s\n", hex.EncodeToString(h.Sum(nil))) // Output encryption result
}

PS: here we provide you with two MD5 encryption tools, interested friends can refer to 1:

MD5 online encryption tool:

http://tools.ofstack.com/password/CreateMD5Password

MD5/hash/ SHA-1 / SHA-2 / SHA-256 / SHA-512 / SHA-3 / RIPEMD-160 encryption tools:

http://tools.ofstack.com/password/hash_md5_sha

I hope this article has been helpful to your programming of Go language.


Related articles: