我正在尝试使用Python访问coinnest.co.kr公司加密货币交易所。为此,我必须遵循这里的文档:https://www.coinnest.co.kr/doc/private.html
We get a key pair of public key: asdf-asdf-asdf-asdf and private key: qwer-qewr-qwer-qwer.
The request parameters are:
"key":"asdf-asdf-asdf-asdf",
"nonce":1505209177,
"coin":"btc",
"id":3
^{pr2}$Then the string to be signed will be:
Now we use the md5 hash of qwer-qewr-qwer-qwer as the key and encrypt the above string by sha256 and we get 66b2935f3ba82a4a17074d439adab1043a63df4a177af68fe76a3f4f350ef55d, which will be used as the signature.
我目前的问题是我无法得到与示例相同的结果。我不确定他们的例子是否准确。是私钥“qwer qewr qwer”或“qwer qwer qwer”。现在是“1505209177”还是“1505209278”?在
#!/usr/bin/python2.7
import hashlib
import hmac
secret = 'qwer-qewr-qwer-qwer'
message = 'key=asdf-asdf-asdf-asdf&nonce=1505209278&coin=btc&id=3'
key = hashlib.md5(secret).hexdigest()
print hmac.new(key, message, hashlib.sha256).hexdigest()
使用上面的代码,我获得了"afdfb1c331670d95c93868948ff769719b28d879ac94589fa44c4d5b8eacab04"
的签名,而不是
"66b2935f3ba82a4a17074d439adab1043a63df4a177af68fe76a3f4f350ef55d"
也许你应该用暴力来强迫API文档?在
对应于:
^{pr2}$因此,以下方法应该有效:
看起来您做的事情是正确的,但是它们的nonce发生了变化,
qwer-qewr-qwer-qwer
私钥是正确的。在相关问题 更多 >
编程相关推荐