多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# Hash Modules ### Author : 品茶 hash模块提供hash、hash32、hash64的接口。像md5的校验和就是使用此接口,此接口提供write sum reset size blocksize的方法。 ## Type hash ~~~ type Hash interface { // Write (via the embedded io.Writer interface) adds more data to the running hash. // It never returns an error. // io.writer interface io.Writer // Sum appends the current hash to b and returns the resulting slice. // It does not change the underlying hash state. // 提供校验和方法 Sum(b []byte) []byte // Reset resets the Hash to its initial state. //提供初始化方法 Reset() // Size returns the number of bytes Sum will return. Size() int // BlockSize returns the hash's underlying block size. // The Write method must be able to accept any amount // of data, but it may operate more efficiently if all writes // are a multiple of the block size. BlockSize() int } ~~~ ## Type hash32 ~~~ type Hash32 interface { Hash Sum32() uint32 } ~~~