25 lines
369 B
Go
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
|
|
}
|