goweb-gin-demo/utils/md5.go

19 lines
303 B
Go
Raw Normal View History

2021-10-29 14:39:50 +08:00
package utils
import (
"crypto/md5"
"encoding/hex"
)
//@author: [piexlmax](https://github.com/piexlmax)
//@function: MD5V
//@description: md5加密
//@param: str []byte
//@return: string
func MD5V(str []byte, b ...byte) string {
h := md5.New()
h.Write(str)
return hex.EncodeToString(h.Sum(b))
}