Example #1
0
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)
}
Example #2
0
File: upload.go Project: 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
}