Bitstamp Encryption

Background

Bitstamp requires encryption in order use their API. The example below has a Python script and the equivalent PHP command for the encryption portion.

How to you convert this Python Script to PHP?

Python Example
import hmac
import hashlibmessage = nonce + customer_id + api_key
signature = hmac.new(
API_SECRET,
msg=message,
digestmod=hashlib.sha256
).hexdigest().upper()

PHP

$token = hash_hmac("sha256", "12345", "sharedpassword");

Python

hmac.new("sharedpassword", "12345", hashlib.sha256).hexdigest()

References

https://stackoverflow.com/questions/9652124/is-there-an-equivalent-of-phps-hash-hmac-in-python-django
https://www.bitstamp.net/api/

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top