【问题标题】:Partial collision for Reduced SHA1 hash减少 SHA1 哈希的部分冲突
【发布时间】:2016-09-05 18:23:07
【问题描述】:

我正在做一个项目来找到两个不同的句子,它们基于减少的 sha1 散列给出部分冲突。我的程序将生成两条不同的消息。如果两个句子的哈希值的前 32 位匹配,则程序将停止,否则将重复直到检测到冲突。

我的程序运行良好,但是搜索冲突的时间很慢。我怎样才能加快物联网。我阅读并发现我可以使用生日悖论,我该如何实现?

我进行了一些搜索并获得了相关答案,但是我仍然对生日悖论感到困惑。

Probability of SHA1 collisions

SHA1 collision demo / example

http://www.metzdowd.com/pipermail/cryptography/2004-August/007409.html

http://www.freelists.org/post/hashcash/Hashcash-and-the-cracking-of-SHA1,2

这就是我的程序的工作方式:

Generate random number() // let say i generate 100 number
Generate random char1() // we will generate 100 char
Hash() // the first 100 char  
Generate random char2() // we will generate another 100 char
Hash2() // this 100 char again
Get the 32 bit of the random char1()
Get the 32 bit of the random char2()
compare the 32 bit for partial collision 
If they dont match we will keep on doing until partial collision is found.
  • 与其他以毫秒为单位的程序相比,搜索所需的时间太长了。

【问题讨论】:

  • 帮我理解一下,为什么是C++标签?

标签: c++ birthday-paradox


【解决方案1】:

如果您通过每次尝试随机输入对来查找哈希函数中的部分冲突,您将不得不接受极长的运行时间。对于 32 位和一个完美的哈希函数,有 1/(2^32) 的碰撞机会。

要利用生日悖论,您需要存储您生成的哈希值并对照它们检查新的哈希值。这是有效的,因为您正在寻找 a 碰撞,您并不真正关心最终碰撞的散列生成的原因。阅读生日悖论如何使用人类和生日,并确保在将其应用于散列之前了解这一点。 By the math here 你只需要大约 77,000 个散列就有 50% 的机会在 32 位中发现它们之间的冲突。

【讨论】:

    猜你喜欢
    • 2013-01-10
    • 2019-03-17
    • 1970-01-01
    • 1970-01-01
    • 2016-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多