Joel Schuster wrote:
> Howdy! I'm placing an md5 encrypted string created via the java.security.MessageDigest and "MD5"
> algorithm in a varchar(16) field.
> When I retrieve it out and compare it against the same string newly created they are not the same.
> When I look at the string retrieved from the database some of the odd characters are now
> converted to something else.
>
> Suggestions?
Well, MD5 is a 128-bit signature.
That amounts to 16 bytes, or for a human and ASCII readable hex string it's 32 bytes.
From the above, I gander that you want to insert the binary 16 bytes rather than a string.
That's fine, but then you need to take proper care when inserting. Use mysql_escape_string().
I'd also make the field CHAR(16) BINARY as it will never be less than 16 bytes, and BINARY just to remind you, but this should have no bearing on the prob. The above info will solve that bit.
Regards, Arjen.
--
Arjen Lentz, Exec.Director @ Open Query (http://openquery.com)
Remote expertise & maintenance for MySQL/MariaDB server environments.
Follow us at
http://openquery.com/blog/ &
http://twitter.com/openquery