def _signature(self, apikey, msg): """Calculation of SHA-512 authentication signature. @param apikey: Trade API-Key {'Key': 'KEY', 'Secret': 'SECRET'} @param msg: Trade API method and parameters""" signature = hmacnew(apikey['Secret'], msg=msg, digestmod=_sha512) self._post_headers['Key'] = apikey['Key'] self._post_headers['Sign'] = signature.hexdigest()
def _signature(cls, apikey, encoded_params): """Calculation of the SHA-512 authentication signature. @param apikey: Trade API-Key {'Key': 'KEY', 'Secret': 'SECRET'} @param encoded_params: Trade API method and parameters""" signature = hmacnew(apikey['Secret'], msg=encoded_params, digestmod=_sha512) cls._post_headers['Key'] = apikey['Key'] cls._post_headers['Sign'] = signature.hexdigest()
def digest(salt): return hmacnew(conf.secret_shared_key, salt).hexdigest()
def salt(): return hmacnew(urandom(8)).hexdigest()