-1

I have some values stored as 128-bit FNV-1a hashes that I would like to "decode". From my understanding, although most hashes are one way, FNV is not a cryptographic hash. Is it possible to "decode" an FNV hash I created myself? I am using golang, example hash below.

value, err := json.Marshal("hello world")
if err != nil {
    fmt.Println(err)
}

fnv128 := fnv.New128a()
_, err = fnv128.Write(value)
if err != nil {
    fmt.Println(err)
}
hash := fnv128.Sum([]byte{})

// given the hash above, find the value "hello world"
Darwin
  • 13
  • 2
  • Do you want to recover inputs that are longer than 128 bits (i.e. 16 bytes)? – David Grayson Sep 14 '21 at 02:49
  • The fact that it is "non-cryptographic" may make it easier to find *something* that hashes to the same value. It does not necessarily make it easier to find the one message you are interested in. On the other hand, if your original message is smaller than the output size of the hash function then it may be possible to "reverse" a non-cryptographic hash function quickly. I don't know anything about FNV specifically. – President James K. Polk Sep 15 '21 at 20:38

1 Answers1

1

You can't "decode" a hash, because a hash is not an encoding, it is a one-way transformation. Just because this hash is not considered cryptographically secure doesn't mean you can reverse it.

Your option is a brute-force search, the feasibility depends on the total space you need to search for matching inputs.

user229044
  • 232,980
  • 40
  • 330
  • 338