在Golang中解码Fnv128哈希的方法是:

huangapple go评论100阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2021年9月14日 10:44:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/69171212.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定