Exemple #1
0
    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)
Exemple #2
0
 def get_hash_of_password(username, password):
     return sha512(username + password)
Exemple #3
0
 def init(self, uname, password):
     self.username = uname
     self.salt = token_hex(32)
     self.password = sha512(self.salt + password)
     return self
Exemple #4
0
 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)