Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
package routines;
import java.security.*;
public class GetHashCode {
public static String getMD5(String strCode) {
java.security.MessageDigest msg;
String digest1 = "";
try {
msg = java.security.MessageDigest.getInstance("MD5");
msg.update(strCode.getBytes(), 0, strCode.length());
digest1 = new java.math.BigInteger(1, msg.digest()).toString(32);
}
catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return digest1.toUpperCase();
}
}
GetHashCode.getMD5(row1.col1 + row1.col2 + row1.col3)
Hi
I used this code and it worked perfectly. Is it possible to fix the number of character of the hash?
Currently it ranges between 23 and 26 characters, and I'd like to fix that, ensuring I have no duplicates.
Thanks