You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
422 B
Go
28 lines
422 B
Go
package starcrypto
|
|
|
|
import (
|
|
"crypto/md5"
|
|
"golang.org/x/crypto/md4"
|
|
)
|
|
|
|
// MD5 输出MD5校验值
|
|
func Md5(bstr []byte) []byte {
|
|
md5sum := md5.New()
|
|
md5sum.Write(bstr)
|
|
return md5sum.Sum(nil)
|
|
}
|
|
|
|
func Md5Str(bstr []byte) string {
|
|
return String(Md5(bstr))
|
|
}
|
|
|
|
func Md4(bstr []byte) []byte {
|
|
md4sum := md4.New()
|
|
md4sum.Write(bstr)
|
|
return md4sum.Sum(nil)
|
|
}
|
|
|
|
func Md4Str(bstr []byte) string {
|
|
return String(Md4(bstr))
|
|
}
|