def __init__(self, private_key, sequence_number=0):
     self._signing_key = SigningKey(private_key)
     self._verify_key = self._signing_key.verify_key
     shazer = new_sha3_256()
     shazer.update(self._verify_key.encode())
     self.address = shazer.digest()
     self.sequence_number = sequence_number
     self.status = AccountStatus.Local
Exemple #2
0
 def __init__(self, private_key, address=None, sequence_number=0):
     self._signing_key = SigningKey(private_key)
     self._verify_key = self._signing_key.verify_key
     shazer = new_sha3_256()
     shazer.update(self._verify_key.encode())
     if address is None:
         self.address = shazer.digest()
     else:
         self.address = Address.normalize_to_bytes(address)
     self.sequence_number = sequence_number
     self.status = AccountStatus.Local
Exemple #3
0
def gen_hasher(name_in_bytes):
    salt = hash_seed(name_in_bytes)
    shazer = new_sha3_256()
    shazer.update(salt)
    return shazer
Exemple #4
0
def hash_seed(clazz_name):
    sha3 = new_sha3_256()
    sha3.update(clazz_name + LIBRA_HASH_SUFFIX)
    return sha3.digest()
Exemple #5
0
 def raw_tx_hash(raw_txn_bytes):
     salt = Client.raw_tx_hash_seed()
     shazer = new_sha3_256()
     shazer.update(salt)
     shazer.update(raw_txn_bytes)
     return shazer.digest()
Exemple #6
0
 def raw_tx_hash_seed():
     sha3 = new_sha3_256()
     RAW_TRANSACTION_HASHER = b"RawTransaction"
     LIBRA_HASH_SUFFIX = b"@@$$LIBRA$$@@"
     sha3.update(RAW_TRANSACTION_HASHER + LIBRA_HASH_SUFFIX)
     return sha3.digest()