简体   繁体   English

如何获得已经散列的数据的真实价值?

[英]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.

相关问题 检查字符串是否已使用BCrypt进行散列 - Check if a string has been hashed with BCrypt or not 如何获得用可编辑的JComboBox编写的值? - How to get value that has been written in editable JComboBox? 用户对其进行编辑后,如何获取EditText的值? - How to get value of EditText after it has been edited by a user? 孩子的数据被推送后如何获取? - How to get a child's data when it has been pushed? 获取在selectOneMenu ListBox中选择的值 - Get the value that has been selected in the selectOneMenu ListBox 如何获得外键的实际值已更改的数据库视图? - How can i get a database view which has foreign keys changed in the real value? 如何根据之前是否打印过相同的值来确定是否打印数组列表中的数据 - How to determine if to print or not to print out data in a array list based on if the same value has been printed before 如何仅获取在 Firebase 中使用 addChildEventListener 修改过的数据? - How can I get only data that has been modified in Firebase using addChildEventListener? 自用户输入数据以来,如何使光标移至已通过程序编辑的EditText的右边缘? - How to get cursor to right edge of an EditText that has been programmatically edited since user put data into it? 如何在数学函数中获得真正的价值 - How to get the real value in a mathematic function
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM