1 Star 0 Fork 0

arjun / iothub-south-client

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
hash_util.go 408 Bytes
一键复制 编辑 原始数据 按行查看 历史
package util
import (
"crypto/md5"
"crypto/sha1"
"fmt"
"hash"
"io"
)
func MD5(reader io.Reader) string {
return calc(md5.New(), reader)
}
func SHA1(reader io.Reader) string {
return calc(sha1.New(), reader)
}
func calc(hash hash.Hash, reader io.Reader) string {
if reader != nil {
_, err := io.Copy(hash, reader)
if err == nil {
return fmt.Sprintf("%X", hash.Sum(nil))
}
}
return ""
}
Go
1
https://gitee.com/arjunxw/iothub-south-client.git
git@gitee.com:arjunxw/iothub-south-client.git
arjunxw
iothub-south-client
iothub-south-client
v0.7.4

搜索帮助