'Unhashing strings C++
I know of the std class std::hash and have hashed values of a vector by using it. But I can't find any documentation or other std classes on unhashing the hashed values.
Can anybody point me in the correct direction of a class that can unhash the hashed strings?
Any help is greatly appreciated!
Solution 1:[1]
Hashing is a process which destroys parts of the information. There is no way to "unhash" something reliabily.
A very simple string hashing algorithm might help you understand better. A very simple (and usually not very good) hashing algorithm for strings is just to sum up all the characters. So you get something like 435 as the hash. This hash contains no more information about the original string, other than the fact that sum of all the bytes that made up the string is 435.
Solution 2:[2]
No, you can't.
Just simple, imagine hash function as addition, let's hash these:
- {5,2} -> 5+2=7
- {3,4} -> 3+4=7
- {6,1} -> 6+1=7
there are countless ways of making 7.
Now, I say let's un-hash "7", we can't.
Solution 3:[3]
Mayme you can try this:
Query query = new Query();
Criteria criteria = new Criteria();
Criteria a = new Criteria();
a.andOperator(Criteria.where("someList").in(Arrays.asList("A","B")),Criteria.where(
"status").is(false),Criteria.where("abcCode").is(6),....)
// B is the same as a
Criteria b = new Criteria();
//...
criteria.orOperator(a,b);
query.addCriteria(criteria);
Solution 4:[4]
I found a very good link to answer my own question : writing complex query in mongo DB
This will help with writing complex queries using @Query annotation for MongoDB.
This will also provide a vivid understanding of how to use AND and OR. Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ayxan Haqverdili |
| Solution 2 | zpc |
| Solution 3 | fan yang |
| Solution 4 | MysteriousCoder |
