mirror of
https://github.com/schollz/croc
synced 2024-07-05 09:08:53 +00:00
update: imohash samples more of the file
This commit is contained in:
parent
50e0f625bc
commit
5cf4d7c103
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user