Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
1.44/5 (4 votes)
See more:
The token is calculated as follows:
sha256(sha256(Request) + "/" + sha256(merchant + "/" + password)), where:

sha256 – calculation of data hash according to the SHA-256 algorithm and hash conversion to HEX in the uppercase format
Request – list of the "key"="value" pairs sorted by key and separated by the "&" character
merchant – Internet shop ID 
password – value set in the PosSecret parameter
<

What I have tried:

Please help detail about this and provide sample sha256
Posted
Updated 26-Mar-20 0:30am

Just use your favourite search engine for the words "SHA256 (language of your choice)", and follow some of the numerous documentations and examples which will show up.
 
Share this answer
 
Comments
Member 14783292 26-Mar-20 3:45am    
Yes thanks dear
Here's the script you need:

<% ' IMPORTANT: save this file as UTF-8 BOM !!!

function sha256(ByVal input)
	Dim hAlg,hEnc,BinaryStream,enc
	set hAlg=CreateObject("System.Security.Cryptography.SHA256Managed")
	set hEnc=CreateObject("System.Text.UTF8Encoding")	
	input=hAlg.ComputeHash_2(hEnc.GetBytes_4(input))
	' --------- security check ----------
	if NOT varType(input)=8209 then
        Set BinaryStream=CreateObject("ADODB.Stream")
		with BinaryStream
			.Type=2
			.CharSet="utf-8"
			.Open
			.WriteText input
			.Position=0
			.Type=1
			.Position=0
			input=.Read
		end with	
		set BinaryStream=Nothing
	end if
	' ----------------------------------
	set enc=CreateObject("MSXML2.DomDocument").CreateElement("encode")
	enc.dataType="bin.hex"
	enc.nodeTypedValue=input
	sha256=enc.Text
	set enc=nothing
	set hEnc=nothing
	set hAlg=nothing
end function

%>
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900