如果我知道某些数据的两部分的哈希值,我可以根据这些哈希值计算出完整数据的哈希值吗?
如果我知道某些数据的两个(或更多)部分的哈希值,我可以根据这些哈希值计算完整数据的哈希值吗?
可以对哪些哈希类型执行此操作? SHA1、SHA256、MD5? (哈希的安全性对于我的用例来说并不重要。)
即
data0 = '0123'
data1 = '45678'
all_data = data0 + data1
hash0 = hash(data0)
hash1 = hash(data1)
fn 是否存在,
hash(all_data) == fn(hash0, hash1)
使得 MD5、SHA1 或 SHA256 是否存在 fn?
谢谢,
克里斯。
If I know the hashes of two (or more) parts of some data, can I calculate the hash of the full data from those hashes?
Which hash types can this be done for? SHA1, SHA256, MD5? (Security of hashes is not important for my use case.)
i.e.
data0 = '0123'
data1 = '45678'
all_data = data0 + data1
hash0 = hash(data0)
hash1 = hash(data1)
Does fn exist such that
hash(all_data) == fn(hash0, hash1)
Does fn exist for MD5, SHA1 or SHA256?
Thanks,
Chris.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
简短的回答。不。
哈希值对于最小偏差来说是完全不同的,除非你无法计算出它们,否则这是行不通的。即使您可以重新计算它们,结果也将是您可以选择的可能性列表。所以没有什么是确定性的。
Short answer. No.
Hashes are completely different for minimal deviations and untill you can't calculate them back this won't work. Even if you can calculate them back, the result will be a list of possibilities you can choose from. So there is nothing deterministic.
通过
data0
进行散列使系统处于某种中间状态。您的hash(data1)
是根据干净状态计算的。您无法修复 hash1 来弥补缺失的中间状态(对于良好的哈希函数)。Hashing through
data0
puts the system in some intermediate state. Yourhash(data1)
was calculated from a clean state. You cannot fix hash1 to make up for that missing intermediate state (for a good hash function).