Question
Tata Consultancy Services
GB
Last activity: 4 Aug 2016 4:27 EDT
How to import java.Security.MessageDigest
Hi I have a requirement to write a java that requires the above referenced library. How can I make this library available to my java activity step please. What are the other alternatives, if there is any, I can use to do this work. I was looking and found I need a .Jar file for the abobe java class. If so whare can I get the .jar file. The java is as below. Many thanks.
String clientRef;
String transactionRef;
String amount;
String securityKey;
String input = clientRef + ";" + transactionRef + ";" + amount + ";" + securityKey;
java.Security.MessageDigest digest = java.Security.MessageDigest.getInstance("SHA-256");
byte[] hash = digest.digest(input.getBytes("UTF-8"));
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < hash.length; i++) {
String hex = Integer.toHexString(0xff & hash[i]);
if(hex.length() == 1 && hexString.length()>0) hexString.append('0');
hexString.append(hex);}
String returnValue = hexString.toString();
***Updated by moderator: Lochan to add Categories***