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.
rizzz86
3 comments:
Do you have sample code on how to use this? thanks.
public static String md5String(String string1) {
MD5 md5 = new MD5();
try {
md5.Update(string1, "iso-8859-1");
} catch (UnsupportedEncodingException ex) {
logger.error(ex.getMessage());
}
return md5.asHex();
}
Thanks for sharing, I will bookmark and be back again
J2ME Application Development
Post a Comment