Created
February 9, 2018 09:38
-
-
Save SanthoshVijayabaskar/c4419216d1ccef0296aba6d89802a4fa 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
UPI DEMO APP :- https://github.com/juspay/upi-sdk | |
UPI SDK Documentation :- http://merchant-doc-v3.bitballoon.com/ | |
repositories { | |
mavenCentral() | |
maven { | |
url "https://s3-ap-south-1.amazonaws.com/staging-assets-test" | |
} | |
} | |
dependencies { | |
compile ('axis-upi:app:0.0.1') | |
// your other dependencies | |
} | |
---- | |
merchantId : "JPMERCHANT" | |
merchantCHannelId : "JPMERCHANT" | |
merchantKey:- qlsUjKdMIDSHfwfwjehfbwebfjwQGRTWQ21323NJNJ0En6blp6SIlmHmvCNhoLuiAL4toSzWo238i35OXtGmmdVlfUWOHGwtv3csriX9GHjiuxqwrbKdVw75NBuxQRLBlyvkewCjephWfOtfpAj9Avob6eCt8MVN6r19jp0Be1rZGNdLhwVjRRdbmOKL1ynXXm9YLF1fLtJcuTff7gtimiNKLWca9iyq171ZkibZoGhknV5UTDDPvgrd0Qkg9mnKqVfFyE8A | |
------- | |
public static String hmacDigest(String msg, String keyString, String algo) { | |
String digest = null; | |
try { | |
SecretKeySpec key = new SecretKeySpec((keyString).getBytes("UTF-8"), algo); | |
Mac mac = Mac.getInstance(algo); | |
mac.init(key); | |
byte[] bytes = mac.doFinal(msg.getBytes("ASCII")); | |
StringBuffer hash = new StringBuffer(); | |
for (int i = 0; i < bytes.length; i++) { | |
String hex = Integer.toHexString(0xFF & bytes[i]); | |
if (hex.length() == 1) { | |
hash.append('0'); | |
} | |
hash.append(hex); | |
} | |
digest = hash.toString(); | |
} catch (UnsupportedEncodingException e) { | |
} catch (InvalidKeyException e) { | |
} catch (NoSuchAlgorithmException e) { | |
} | |
return digest; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment