Suppose I hashed a password and obtained a hashcode for it. I need to find the degree of similarity between the password and its hashcode. Please suggest me some different mechanism 开发者_如何学Cfor this
This is impossible. That's the entire point of secure hash algorithms that are used, among other things, to hash passwords.
If you mean the md5 hash of the password, what is known is if you give same string and calculate the md5 hash it, they will produce the same results. There are also cases when two different strings a and b can hash to the same output too.That is called as collision in cryptographic terms.
But if you are asking for the relation between the string and the generated output, then the best answer is the Algorithm which is followed to calculate the md5 hash and as you are see it is pretty complicated as operates at the bit level to produce the final output.
You might want to look at string metrics (although it could be helpful if you elaborated a bit more on the details of your task, as Glenn stated this does not make much sense).
You could look into String Edit Distance (aka Levenshtein Distance) as a metric. It'll give you the least cost set of operations (insert, delete, substitute) between the password and its hash.
I'm not sure why you'd want to do this.
精彩评论