How to hash/encrypt a string to protect private information but still make the string comparable
Given a string how to create a unique identifier / hash for that string so that one can track the occurence of the string without actually logging the original string.
For example a URL "www.mylittlesecret.com" should show up as "xyz123" (hascode for that string). So that 开发者_StackOverflow中文版the url always translates into xyz123 but from xyz123 one can't determine the url.
Sorry if those are the wrong terms. I am happy to read more about "hashing" if somebody could provide me the right keywords.
If you use a hash algorithm like SHA1 you will get the desired behavior. You will not be able to reconstruct your URL from the hash, but you can compare the hashes and see if the URLs are the same or not.
But if someone wants to find out what URLs you have you will be subjected to dictionary like attacks, where a users simply takes a list of all known web sites and sees if the hashes matches. So that might be something to watch out for.
精彩评论