您可能需要查看“SHAttered”示例,其中有 2 个具有相同 SHA1 哈希值的不同 PDF 文件。
Yes. The range of any hash function is limited by the number of bits. For example, if we were to use a hash function outputting 8 bits, then we only have 256 possible outputs; so if we have more than 256 possible inputs then we are guaranteed to have a collision.
If we use a hash function with a larger range then it becomes much less likely to have a collision; but cannot make it impossible because our inputs are unlimited.
The existence of collisions is part of the reason why these functions are one way: a given output could have been generated from an unlimited number of different inputs.
We should also use a good cryptographic hash function to help avoid collisions from similar input.
You may want to look at the "SHAttered" example of 2 different PDF files that have the same SHA1 hash.
发布评论
评论(1)
是的。任何哈希函数的范围都受到位数的限制。例如,如果我们使用输出 8 位的哈希函数,那么我们只有 256 个可能的输出;因此,如果我们有超过 256 个可能的输入,那么我们肯定会发生碰撞。
如果我们使用范围更大的哈希函数,那么发生冲突的可能性就会大大降低;但不能让它成为不可能,因为我们的投入是无限的。
冲突的存在是这些函数是一种方式的部分原因:给定的输出可以由无限数量的不同输入生成。
我们还应该使用良好的加密哈希函数来帮助避免类似输入的冲突。
您可能需要查看“SHAttered”示例,其中有 2 个具有相同 SHA1 哈希值的不同 PDF 文件。
Yes. The range of any hash function is limited by the number of bits. For example, if we were to use a hash function outputting 8 bits, then we only have 256 possible outputs; so if we have more than 256 possible inputs then we are guaranteed to have a collision.
If we use a hash function with a larger range then it becomes much less likely to have a collision; but cannot make it impossible because our inputs are unlimited.
The existence of collisions is part of the reason why these functions are one way: a given output could have been generated from an unlimited number of different inputs.
We should also use a good cryptographic hash function to help avoid collisions from similar input.
You may want to look at the "SHAttered" example of 2 different PDF files that have the same SHA1 hash.