i'm using MD5 hashing to encrypt passwords for a program. But it is not creating all the characters and that to some are unreadable. Here is an screenshot. link-http://i46.tinypic.com/2qvf2o2.jpg
Any help is appreciated
i'm using MD5 hashing to encrypt passwords for a program. But it is not creating all the characters and that to some are unreadable. Here is an screenshot. link-http://i46.tinypic.com/2qvf2o2.jpg
Any help is appreciated
Presumably you want to convert the array of bytes returned by MD5 to a hexidecimal string for display. Something like d131dd02c5e6eec4.
Here's how you can do that:
In Java, how do I convert a byte array to a string of hex digits while keeping leading zeros?
You're interpreting the bytes returned by MD5 as raw character data.
Since MD5 does not return bytes that represent characters, you get meaningless results.
What you're getting back is a binary value. So it's a bunch of raw bytes that may or may not map to valid characters in your default codepage. What you should do is convert the byte[] to hex. You can use something like Apache Commons Codec to encode this. http://commons.apache.org/codec/apidocs/org/apache/commons/codec/binary/Hex.html#encodeHex(byte[])