在 python 中重新散列
我正在尝试从包含哈希数据的文件中读取行。 使用以下代码对数据进行哈希处理:
encoder = hashlib.sha224()
encoder.update(string)
file.write(encoder.hexdigest())
如何重新哈希数据?
I am trying to read lines from a file which contains hashed data.
The data was hash with the following code:
encoder = hashlib.sha224()
encoder.update(string)
file.write(encoder.hexdigest())
how do I rehash the data?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如已经说过的,你不能这样做,这就是散列背后的实际想法。我认为您真正需要的是加密。
当数据被加密时,任何人都无法读取它。只有当你知道如何解密时,你才能再次阅读它。有许多不同的加密方式,例如对称和非对称,只需阅读相关内容,或者提供有关您真正想要做什么的更多信息,以便我们可以告诉您应该使用哪种加密。
As already said, you can't do that, and that's the actual idea behind hashing. I think what you are really looking for is encryption.
When the data is encrypted, nobody can read it. Only when you know how to decrypt it, you can read it again. There are many different ways of encryption, such as symmetric and asymmetric, just read about it, or supply more information about what you are really trying to do so we can tell you what encryption you should use.