7
cryptox/crc32.go
Normal file
7
cryptox/crc32.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package cryptox
|
||||
|
||||
import "hash/crc32"
|
||||
|
||||
func Crc32(s string) uint32 {
|
||||
return crc32.ChecksumIEEE([]byte(s))
|
||||
}
|
||||
12
cryptox/md5.go
Normal file
12
cryptox/md5.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package cryptox
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
func Md5(s string) string {
|
||||
h := md5.New()
|
||||
h.Write([]byte(s))
|
||||
return hex.EncodeToString(h.Sum(nil))
|
||||
}
|
||||
12
cryptox/sha1.go
Normal file
12
cryptox/sha1.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package cryptox
|
||||
|
||||
import (
|
||||
"crypto/sha1"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
func Sha1(s string) string {
|
||||
h := sha1.New()
|
||||
h.Write([]byte(s))
|
||||
return hex.EncodeToString(h.Sum(nil))
|
||||
}
|
||||
Reference in New Issue
Block a user