Esempio n. 1
0
 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()
Esempio n. 2
0
    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()
Esempio n. 3
0
def digest(salt):
    return hmacnew(conf.secret_shared_key, salt).hexdigest()
Esempio n. 4
0
def salt():
    return hmacnew(urandom(8)).hexdigest()