q5/strutils.go
aozhiwei de0c368e4c 1
2020-09-07 19:29:17 +08:00

25 lines
369 B
Go

package q5
import "io"
import "crypto/md5"
import "encoding/hex"
import "hash/crc32"
func Test()(a string) {
return "testb"
}
func Md5Str(data string) string {
h := md5.New()
h.Write([]byte(data))
return hex.EncodeToString(h.Sum(nil))
}
func Crc32(data string) uint32 {
ieee := crc32.NewIEEE()
io.WriteString(ieee, data)
code := ieee.Sum32()
return code
}