Contents

Generating site security hash

 

Use the following examples to assist in developing your own code, for generating the site security hash:

 


#!/usr/bin/python

import hashlib
stringToHash= "USD100.00test_site123452defaultPASSWORD"
print hashlib.sha256(stringToHash).hexdigest()
<?php
echo hash("sha256", "USD100.00test_site123452defaultPASSWORD");
?>
import java.math.BigInteger;
import java.security.MessageDigest;
public class mysha256 {
    public static void main(String args[]) throws Exception {
	String stringToHash = "USD100.00test_site123452defaultPASSWORD";
	MessageDigest digestObj = MessageDigest.getInstance("SHA-256");
	digestObj.update(stringToHash.getBytes("UTF-8"));
	String merchantHash = String.format("%064x",new BigInteger(1,digestObj.digest()));
	System.out.println(merchantHash);
    }
}
#!/usr/bin/perl

use Digest::SHA qw(sha256_hex);
$stringToHash = "USD100.00test_site123452defaultPASSWORD";
$merchantHash = sha256_hex($stringToHash);
print $merchantHash;