glaslos / ssdeep

SSDEEP hash lib in Golang
Other
100 stars 35 forks source link

HashDistance() with hash of file 192 bytes length gives unclear error 'Apples != Grapes' #3

Closed oneumyvakin closed 7 years ago

oneumyvakin commented 7 years ago

STEPS

  1. Create file with 192 bytes length:

    123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012
  2. Try to HashDistance() with some random file:

    package main
    import (
    "github.com/glaslos/ssdeep"
    "fmt"
    )
    func main() {
    deepMaingo := ssdeep.NewSSDEEP()
    deepMaingoStr := deepMaingo.Fuzzy("main.go")
    fmt.Printf("deepMaingoStr: '%s'\n", deepMaingoStr)
    deep192 := ssdeep.NewSSDEEP()
    deep192Str := deep192.Fuzzy("192.txt")
    fmt.Printf("deep192Str : '%s'\n", deep192Str )
    distance, err := ssdeep.HashDistance(deepMaingoStr, deep192Str )
    fmt.Printf("Distance: '%d' Error: '%s'\n", distance, err)
    }

ACTUAL RESULT Error 'Apples != Grapes' is unclear:

block size: 3, file size: 192, n/bs: 64
deep192Str: '3:OWGukOWGukOWGukOWGukOWGukOWGukOWGukOWGukOWGukOWGukOWGukOWGukOWGU:OWGukOWGukOWGukOWGukOWGukOWGukOw,"192.txt"'
Distance: '0' Error: 'Apples != Grapes'
glaslos commented 7 years ago

See #4