Hi All,
I want to generate output of 16 character using MD5 algorithm. general output while performing the function is 128 bit. i have reduced it to 20character using BASE64.
here is the code:
public class MD5Algorithm{
public static void main(
String args[]){
String password="Welcome";
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
final byte[] md5Digest = md.digest(password.getBytes());
final BigInteger md5Number = new BigInteger(1, md5Digest);
final String md5String = md5Number.toString();
// print out the digest in base64
BASE64Encoder encoder = new BASE64Encoder();
String base64 = encoder.encode(md5Digest);
System.out.println(base64);
}
Please help me for getting the output.
thanks in advance.