replace zxq.co/ripple/hanayo
This commit is contained in:
26
vendor/github.com/felipeweb/gopher-utils/digester.go
generated
vendored
Normal file
26
vendor/github.com/felipeweb/gopher-utils/digester.go
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
package gopher_utils
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"crypto/sha512"
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
func Sha256(str string) string {
|
||||
hash := sha256.New()
|
||||
hash.Write([]byte(str))
|
||||
return hex.EncodeToString(hash.Sum(nil))
|
||||
}
|
||||
|
||||
func Sha512(str string) string {
|
||||
hash := sha512.New()
|
||||
hash.Write([]byte(str))
|
||||
return hex.EncodeToString(hash.Sum(nil))
|
||||
}
|
||||
|
||||
func Md5(str string) string {
|
||||
hash := md5.New()
|
||||
hash.Write([]byte(str))
|
||||
return hex.EncodeToString(hash.Sum(nil))
|
||||
}
|
Reference in New Issue
Block a user