Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am using below code/routine in Talned 7.2.1
Java 11 is the version installed in my system
below code is not working and erroring out saying javax.xml.bind.DatatypeConverter can not be resolved. can anyone help me here on this .
my requirement is to message digest the string/strings passed .
package routines;
import java.security.MessageDigest;
import javax.xml.bind.DatatypeConverter;
public class MD5_HashFunction{
/**
* Returns a hexadecimal encoded MD5 hash for the input String.
* {Category} Userdefined
* {param} data
* @return
*/
public static String getMD5Hash(String... data) {
StringBuilder sb = new StringBuilder();
for(String str : data){
sb.append(str);
}
String result = null;
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
byte[] hash = digest.digest(sb.toString().getBytes("UTF-8"));
return DatatypeConverter.printHexBinary(hash); // make it printable
} catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
}
Thanks for your reply , I have changed the java version to the compatibility one and its working fine ...