Skip to content

Commit 5cf4d7c

Browse files
committed
update: imohash samples more of the file
1 parent 50e0f62 commit 5cf4d7c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/utils/utils.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,16 @@ func MD5HashFile(fname string, doShowProgress bool) (hash256 []byte, err error)
186186
return
187187
}
188188

189+
var imofull = imohash.NewCustom(0, 0)
190+
var imopartial = imohash.NewCustom(16*16*8*1024, 128*1024)
191+
189192
// IMOHashFile returns imohash
190193
func IMOHashFile(fname string) (hash []byte, err error) {
191-
b, err := imohash.SumFile(fname)
194+
b, err := imopartial.SumFile(fname)
192195
hash = b[:]
193196
return
194197
}
195198

196-
var imofull = imohash.NewCustom(0, 0)
197-
198199
// IMOHashFileFull returns imohash of full file
199200
func IMOHashFileFull(fname string) (hash []byte, err error) {
200201
b, err := imofull.SumFile(fname)

src/utils/utils_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func TestIMOHashFile(t *testing.T) {
108108
defer os.Remove("bigfile.test")
109109
b, err := IMOHashFile("bigfile.test")
110110
assert.Nil(t, err)
111-
assert.Equal(t, "c0d1e123ca94148ffea146137684ebb9", fmt.Sprintf("%x", b))
111+
assert.Equal(t, "c0d1e12301e6c635f6d4a8ea5c897437", fmt.Sprintf("%x", b))
112112
}
113113

114114
func TestXXHashFile(t *testing.T) {

0 commit comments

Comments
 (0)