update
parent
110c5088cc
commit
49b5ec8cd8
|
@ -3,6 +3,7 @@ package mycrypto
|
|||
import (
|
||||
"crypto/md5"
|
||||
"crypto/sha1"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
|
@ -18,3 +19,9 @@ func Sha1(str string) string {
|
|||
h.Write([]byte(str))
|
||||
return hex.EncodeToString(h.Sum(nil))
|
||||
}
|
||||
|
||||
func Sha256(str string) string {
|
||||
h := sha256.New()
|
||||
h.Write([]byte(str))
|
||||
return hex.EncodeToString(h.Sum(nil))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue