def calculate_hash(self): # increase the sequence to avoid 2 identical transactions having the same hash Transaction.sequence += 1 message = self.sender + self.recipient + str(self.value) + str( Transaction.sequence) return sha512(message)
def get_hash_of_password(username, password): return sha512(username + password)
def init(self, uname, password): self.username = uname self.salt = token_hex(32) self.password = sha512(self.salt + password) return self
def authenticate(self, password): if self.password == sha512(self.salt + password): return True return False
def calculate_hash(self): message = self.recipient + str(self.value) + self.parent_transaction_id return sha512(message)