简体   繁体   English

Java和python中的Whirlpool哈希给出不同的结果

[英]Whirlpool hash in java and in python give different results

I have two projects. 我有两个项目。 panager and panager-android . panagerpanager-android I use the whirlpool hash algorithm and with the same data panager gives different results than panager-android. 我使用漩涡哈希算法,并且在相同的数据下,panager提供的结果与panager-android不同。 panager is written in python and panager-android (guess) in java. panager用python编写,而panager-android(guess)用Java编写。 I'm ultra-new in java so take it easy :P 我是Java的超新手,请放轻松:P

In python I use a module that I found on the net (whirlpool.py) and in java I use the jacksum library. 在python中,我使用在网上(whirlpool.py)上找到的模块,而在java中,我使用jacksum库。

There are different versions of the Whirlpool spec which generate different output for the same input. 惠而浦规范有不同的版本,它们为相同的输入生成不同的输出。 It looks like whirlpool.py might be implementing the original Whirlpool (referred to as "Whirlpool-0"), whereas in panager-android you use Whirlpool-2: 看起来whirlpool.py可能正在实现原始的Whirlpool(称为“ Whirlpool-0”),而在panager-android中,您使用Whirlpool-2:

AbstractChecksum encode = JacksumAPI.getChecksumInstance("whirlpool2");

Try changing that to "whirlpool0" and see if it matches your Python implementation now. 尝试将其更改为“ whirlpool0”,然后查看它是否与您的Python实现匹配。 Failing that, try "whirlpool1". 如果失败,请尝试“ whirlpool1”。

Wikipedia has known Whirlpool hashes from each version for a given test input which you may use to identify the version of a questioned Whirlpool implementation, or find out if it's just entirely wrong and broken. Wikipedia 从给定测试输入的每个版本中知道了Whirlpool哈希 ,您可以使用它们来识别有疑问的Whirlpool实现的版本,或者找出它是否完全错误和损坏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM