File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1+ var sha512 = require ( 'js-sha512' ) ;
2+ var apiLogin = "2Kfn5S7x7D" ;
3+ var transId = "60115585081" ;
4+ var amount = '12.00' ;
5+ var signatureKey = '56E529FE6C63D60E545F84686096E6AA01D5E18A119F18A130F7CFB3983104216979E95D84C91BDD382AA0875264A63940A2D0AA5548F6023B4C78A9D52C18DA' ;
6+ var textToHash = "^" + apiLogin + "^" + transId + "^" + amount + "^" ;
7+
8+ function generateSHA512 ( textToHash , signatureKey )
9+ {
10+ if ( textToHash != null && signatureKey != null ) {
11+ var sig = sha512 . hmac ( Buffer . from ( signatureKey , 'hex' ) , textToHash ) . toUpperCase ( ) ;
12+ console . log ( "Computed SHA512 Hash: " + sig + "\n" ) ;
13+ } else {
14+ console . log ( "Either Signature key or the text to hash is empty \n" ) ;
15+ }
16+ }
17+
18+ generateSHa512 ( textToHash , signatureKey ) ;
You can’t perform that action at this time.
0 commit comments