[英]how to get the real value of data that has been hashed?
how to get the real value of data that has been hashed? 如何获得已经散列的数据的真实价值? is it possible that you can still get the real value of the data after you get the hashcode? 获得哈希码后,您仍然可以获得数据的真实价值吗? or is there any code that can reverse the output. 或者是否有任何代码可以反转输出。
String ida = new String(txtID.getText().toString());
int idb = ida.hashCode();
codeD.setText("result: " + ida );
i already get the hashcode of the txtID(the user that has been input), but now i want to get the the real value that has been hashed without calling the ida. 我已经获得了txtID(已输入的用户)的哈希码,但现在我想获得已经哈希的实际值而不调用ida。
Short answer: no. 简答:不。
The long answer: A hash is meant to be a quick, one-way calculation to roughly identify some item. 答案很长:散列是一种快速的单向计算,可以粗略地识别某些项目。 In Java, hash codes are usually used to putting something into a Map. 在Java中,哈希码通常用于将某些内容放入Map中。 The hash code is used to identify one Object from another when it is used as a key in the HashMap. 当哈希代码用作HashMap中的键时,哈希代码用于标识另一个Object。 It is not meant to store the data, only be different enough to prevent collisions. 它并不意味着存储数据,只是足够不同以防止冲突。 It is quite possible to have two objects that have the same hash. 很可能有两个具有相同散列的对象。
As CodeChimp explained, what you are trying to do is not Hashing, but Encrypt/Decrypt . 正如CodeChimp所解释的那样,你要做的不是哈希,而是加密/解密 。 This example will help you do it: http://www.example-code.com/java/aes_dataStream.asp 此示例将帮助您执行此操作: http : //www.example-code.com/java/aes_dataStream.asp
If you are like me and enjoy reinventing the wheel, this could be fun to implement: http://en.wikipedia.org/wiki/Affine_cipher 如果你像我一样喜欢重新发明轮子,这可能很有趣: http : //en.wikipedia.org/wiki/Affine_cipher
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.