Hash

HOW TO HASH USING SHA256

Step 1

String stringToHash = amount=100&callbackUrl=https://checkout.seerbit.com/?m=EQREZEhyRn&country=NG&currency=NGN&email=kolawole@gmail.com&paymentReference=5fgj77treo&productDescription=RiceandBeans&productId=Foods&publicKey=EQREZEhyR

Step 2

String hashString = stringToHash + privateKey;

Step 3

Hash = Sha256(hashString);

Hash Algorithm in Java

public static String Sha256(String rawKey) throws ProcessingException {
try {
MessageDigest md = MessageDigest.getInstance("SHA-256");
byte[] encrypted = md.digest(rawKey.getBytes());
return new String(Hex.encodeHex(encrypted));
} catch (NoSuchAlgorithmException ex) {
String errorMessage = "Unable to hash this string";
throw new ProcessingException(errorMessage);
}
}