1
0
mirror of https://github.com/schollz/croc synced 2024-07-02 23:58:42 +00:00

update: imohash samples more of the file

This commit is contained in:
Zack 2024-06-06 10:19:23 -07:00
parent 50e0f625bc
commit 5cf4d7c103
2 changed files with 5 additions and 4 deletions

View File

@ -186,15 +186,16 @@ func MD5HashFile(fname string, doShowProgress bool) (hash256 []byte, err error)
return
}
var imofull = imohash.NewCustom(0, 0)
var imopartial = imohash.NewCustom(16*16*8*1024, 128*1024)
// IMOHashFile returns imohash
func IMOHashFile(fname string) (hash []byte, err error) {
b, err := imohash.SumFile(fname)
b, err := imopartial.SumFile(fname)
hash = b[:]
return
}
var imofull = imohash.NewCustom(0, 0)
// IMOHashFileFull returns imohash of full file
func IMOHashFileFull(fname string) (hash []byte, err error) {
b, err := imofull.SumFile(fname)

View File

@ -108,7 +108,7 @@ func TestIMOHashFile(t *testing.T) {
defer os.Remove("bigfile.test")
b, err := IMOHashFile("bigfile.test")
assert.Nil(t, err)
assert.Equal(t, "c0d1e123ca94148ffea146137684ebb9", fmt.Sprintf("%x", b))
assert.Equal(t, "c0d1e12301e6c635f6d4a8ea5c897437", fmt.Sprintf("%x", b))
}
func TestXXHashFile(t *testing.T) {