Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Sudhee_Maximus
Creator
Creator

Routine not working for md5 function

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;
}

}

Labels (2)
1 Solution

Accepted Solutions
manodwhb
Champion II
Champion II

2 Replies
manodwhb
Champion II
Champion II

Check the below link to know the java compatability
https://help.talend.com/reader/Vf4kncNeAlVQT~Kv9TVUVQ/1DA7YYAOxD0kKX6~dDLjew
Sudhee_Maximus
Creator
Creator
Author

Thanks for your reply , I have changed the java version to the compatibility one and its working fine ...