Using PHP for a transaction posted to the SIM gateway, fingerprint generation is based on the following function:
Not being very familiar with either PHP or hash functions, I'm hoping someone can tell me what the equivalent Python code is to generate a valid fingerprint (presumably using the hashlib module).
Solved! Go to Solution.
03-25-2016 07:50 PM
The code posted previously needs to be corrected to reverse the order of the arguments to hmac.new(). The following is what I'm now using successfully in my Python-based interface to the gateway:
import hmac def HMAC(key,data): return(hmac.new(key,data).hexdigest())
03-28-2016 07:26 AM
After considerable trial and error, I find that the following appears to produce the same output as the PHP version:
import hmac
def HMAC(key,data):
return(hmac.new(data,key).hexdigest())
03-25-2016 08:37 PM - edited 03-25-2016 08:38 PM
The code posted previously needs to be corrected to reverse the order of the arguments to hmac.new(). The following is what I'm now using successfully in my Python-based interface to the gateway:
import hmac def HMAC(key,data): return(hmac.new(key,data).hexdigest())
03-28-2016 07:26 AM