封装的方法类
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package sha256x
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
//Sha256加密
|
||||
func Sha256(src string) string {
|
||||
m := sha256.New()
|
||||
m.Write([]byte(src))
|
||||
res := hex.EncodeToString(m.Sum(nil))
|
||||
return res
|
||||
}
|
||||
Reference in New Issue
Block a user