public final class Khash extends Object
| Modifier and Type | Method and Description |
|---|---|
static Khash |
getInstance()
Method to retrieve the singleton Khash instance.
|
protected String |
hash(String token)
Hash a payment token using the Kount hash algorithm.
|
String |
hashGiftCard(int merchantId,
String token)
Hash a gift card payment token using the Kount hashing algorithm.
|
String |
hashPaymentToken(String token)
Create a Kount hash of a provided payment token.
|
protected static String |
sha1(String plainText)
Perform SHA1 hash on a string.
|
static String |
sha256(String plain) |
public static Khash getInstance() throws RuntimeException
kount.config.key
system variable must be present in order for the instance to be initialized.RuntimeException - A RuntimeException is thrown if kount.config.key
system variable has not been set.public static String sha256(String plain) throws NoSuchAlgorithmException
NoSuchAlgorithmExceptionpublic String hashPaymentToken(String token) throws NoSuchAlgorithmException
token - Payment token to be hashedNoSuchAlgorithmException - When SHA-1 isn't supportedpublic String hashGiftCard(int merchantId, String token) throws NoSuchAlgorithmException
merchantId - Merchant IDtoken - Payment token to be hashedNoSuchAlgorithmException - When SHA-1 isn't supported.protected String hash(String token) throws NoSuchAlgorithmException
token - Payment token to be hashedNoSuchAlgorithmException - When SHA-1 isn't supportedprotected static String sha1(String plainText) throws NoSuchAlgorithmException
plainText - String to be hashedNoSuchAlgorithmException - When SHA-1 isn't supportedCopyright © 2022. All rights reserved.