Last active
October 30, 2019 15:52
-
-
Save deepak140596/e7bceea401bea9f9a0bce683efaa4808 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String hashSequence = merchantKey + "|" + txnId + "|" + amount + "|" + productInfo + "|" + firstName + "|" + email + "|" + | |
udf1 + "|" + udf2 + "|" + udf3 + "|" + udf4 + "|" + udf5 + "|" + "|" + "|" + "|" + "|" + "|" + salt; | |
public static String hashCal(String type, String hashString) { | |
StringBuilder hash = new StringBuilder(); | |
MessageDigest messageDigest = null; | |
try { | |
messageDigest = MessageDigest.getInstance(type); | |
messageDigest.update(hashString.getBytes()); | |
byte[] mdbytes = messageDigest.digest(); | |
for (byte hashByte : mdbytes) { | |
hash.append(Integer.toString((hashByte & 0xff) + 0x100, 16).substring(1)); | |
} | |
} catch (NoSuchAlgorithmException e) { | |
e.printStackTrace(); | |
} | |
return hash.toString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment