【发布时间】:2018-07-28 06:28:32
【问题描述】:
我正在做一些散列实验。我在做一个简单的测试时遇到了问题。
这是我的代码:
String newWord = readFile("C:\\Users\\javip\\Desktop\\Workspace SSII\\listado-general.txt").get(5);
System.out.println(newWord);
String qwerty = "qwerty2";
System.out.println(qwerty);
System.out.println(newWord.equals(qwerty));
String sha256hex = DigestUtils.sha256Hex(newWord);
System.out.println(DigestUtils.sha256Hex(qwerty));
System.out.println(DigestUtils.sha256Hex(sha256hex));
这是我的控制台打印的内容:
qwerty2
qwerty2
true
42ad28944380f770cf17432c3494c07c32f680173b42c3562888f096e738ef7a
ebd11cf2e1a82248edff75899ba331ffa35787c070767da0c695bba8e2be5355
我做错了什么?我通过 Intenet 的一些 SHA256 加密器的缓刑知道
42ad28944380f770cf17432c3494c07c32f680173b42c3562888f096e738ef7a
是使用 SHA256 的“qwerty2”的正确哈希。
【问题讨论】:
-
为什么你认为双散列
newWord(DigestUtils.sha256Hex(DigestUtils.sha256Hex(newWord))) 等于单散列qwerty(DigestUtils.sha256Hex(qwerty))? -
天啊...谢谢你们... 几个小时的问题,你只是对自己的代码视而不见。
-
欢迎接受下面的正确答案。