How to verify if a string value is a plain text or MD5 converted Hex value
posted 2 years ago
Hi. I am very new to web service development world. I am extracting the password from which is md5 encripted hex data. Now I am taking the the password value from the property file. From the property file the password could a plain text or MD5 encripted value. Now after I get the value from perperty file first I have to check if it is a plain text value or md5 encripted hex value. How would I check if a string value is a plain text or md5 encripted hex value. I would really appreciate if someone can give me any idea. Please let me know if I am not clear enough or need any other informations. Thank you very much.
HEX encoding results in 'plain text' so one cannot for sure determine that a value is the password or the HEX encoded MD5 digest of the password. What one can say is that a HEX encoded MD5 digest will contain exactly 32 characters taken from the set [0-9,A-F,a-f] . I don't know of anybody who uses passwords anywhere near that specification so if an entry does match that specification then I would bet that it is a HEX encoded MD5 digest.
It is relatively simple to write a regular expression to check for an entry meeting the HEX encoded MD5 digest specification.
P.S. MD5 is a 'digest' and not an 'encryption'. It cannot be 'decrypted' .