This is a creation in Article, where the information may have evolved or changed.
first, from a simple point, It 's also used to compare multiple MD5 encryption to start, not much to say directly on the code
Package Signimport ' crypto/md5 ' type md5client struct {}var MD5 = Md5client{}func (this *md5client) Encrypt (Plantext []byte ) []byte {result: = MD5. Sum (Plantext) return result[:]}/* to the information to be encrypted add salt */func (this *md5client) Encryptwithsalt (Plantext []byte,salt []byte] []byt] e {hash: = MD5. New () hash. Write (Plantext) hash. Write (salt) return hash. Sum (Nil)}
For the definition of salt, please poke here
After the encrypted 16-bit byte array, if you want to turn into a string, you can use the 16 character set for transcoding, the code is as follows
Func Main () {sum:=sign. MD5. Encrypt ([]byte (' Sweet Potato duck ')] sumstr:=hex. Encodetostring (SUM)}
Ok,md5 to the end, simple, next we talk about AES ...