英文:
decode fnv128 hash in golang
问题
我有一些存储为128位FNV-1a哈希值的值,我想要"解码"它们。据我了解,尽管大多数哈希是单向的,但FNV不是一个加密哈希。我能否"解码"我自己创建的FNV哈希?我正在使用golang,以下是示例哈希:
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{})
// 给定上述哈希,找到值"hello world"
英文:
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"
答案1
得分: 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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论