====== Java MD5 Example Library ======
==== Examples ====
=== How to calculate the MD5 hash ===
The following packages need to be imported:
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.math.BigInteger;
== Example ==
public String createMD5Hash (String token) {
String s = token;
MessageDigest m;
String returnstring = null;
try {
m = MessageDigest.getInstance("MD5");
m.update(s.getBytes(),0,s.length());
returnstring = new BigInteger(1,m.digest()).toString(16);
System.out.println("MD5: "+ returnstring);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return returnstring;
}