CompanyNum + TransType + TypeCredit + Amount + Currency + CardNum + RefTransID + PersonalHashKey
1234567 + 1 + 1 + 5.4 + 1 + 4580000000000000 + 1234 + AU7E468HNF
The correct output with URLEncoded is “yZo3as0hwZMOO%2bVO0sTXSg%3d%3d”.
The correct output without URLEncoded is “yZo3as0hwZMOO+VO0sTXSg==”.
Public Class Signature
Public Shared Function GenerateSHA256(ByVal value As String) As String
Dim sh As System.Security.Cryptography.SHA256 = System.Security.Cryptography.SHA256.Create()
Dim hashValue As Byte() = sh.ComputeHash(System.Text.Encoding.UTF8.GetBytes(value))
Return System.Convert.ToBase64String(hashValue)
End Function
End Class
'Usage Example
Dim sSignature As String = Signature.GenerateSHA256("1234567ABCDEFGHIJ")
public class Signature
{
public static string GenerateSHA256(string value)
{
System.Security.Cryptography.SHA256 sh = System.Security.Cryptography.SHA256.Create();
byte[] hashValue = sh.ComputeHash(System.Text.Encoding.UTF8.GetBytes(value));
return System.Convert.ToBase64String(hashValue);
}
}
//Usage Example
string sSignature = Signature.GenerateSHA256("1234567ABCDEFGHIJ");
$val=base64_encode(hash("sha256", "1234567ABCDEFGHIJ", true));