Wednesday, January 12, 2011

MD5 Hashing in J2ME

MD5 (Message Digest) is a hashing algorithm that can be used to ensure data integrity, save and protect passwords/codes, generate unique keys of limited length against a long literal etc. It takes input as String and generates the Hash of that string.

In JAVA there is a built-in MD5 support in its Standard Edition (J2SE). But if we talk about its Micro Edition (J2ME) their is no support for MD5. The package of JAVA Standard Edition can also be used in Micro Edition if and only if the platform supports the SATSA-Crypto Optional Package (How to know that your platform supports SATSA-Crypto).

I have found and tested the Third-Party implementation that can generate MD5 hash and can be used in JAVA Micro Edition. You can get the MD5 source files from here.



Anonymous said...

Do you have sample code on how to use this? thanks.

Rizwan Ahmed said...

public static String md5String(String string1) {
MD5 md5 = new MD5();
try {
md5.Update(string1, "iso-8859-1");
} catch (UnsupportedEncodingException ex) {
return md5.asHex();

nago said...

Thanks for sharing, I will bookmark and be back again

J2ME Application Development