示例#1
0
文件: hash_test.go 项目: zqzca/back
func TestHash(t *testing.T) {
	t.Parallel()
	a := assert.New(t)
	b := bytes.NewReader([]byte("boo"))

	h, err := lib.Hash(b)
	a.Nil(err)
	a.Equal("78b371f0ea1410abc62ccb9b7f40c34288a72e1a", h)
}
示例#2
0
文件: upload.go 项目: zqzca/back
func (u *upload) hashData() error {
	br := bytes.NewReader(u.data)
	var err error
	u.localHash, err = lib.Hash(br)

	if err != nil {
		return err
	}

	_, err = br.Seek(0, os.SEEK_SET)
	return err
}