您的位置:首页 > 理论基础 > 计算机网络

go语言使用crc32得到网络消息的校验码

2012-10-19 16:43 996 查看
package main

import (
"fmt"
"hash/crc32"
"io")

func main(){
//hash := crc32.NewIEEE()

check_str := "Discard medicine more than two years old."
//hash.write(check_str)
//hash.Sum()
ieee := crc32.NewIEEE()
io.WriteString(ieee, check_str)

s := ieee.Sum32()
fmt.Println("IEEE(%s) = 0x%x",check_str,s)

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: