mirror of https://github.com/nucypher/nucypher.git
Using keccak-256 for hashing. Closes #45.
parent
9e314d8b81
commit
c55c0302e7
|
@ -1,10 +1,10 @@
|
|||
import random
|
||||
import sha3
|
||||
|
||||
|
||||
# TODO: Replace these with actual hash functions.
|
||||
|
||||
def signature_hash(hash_input):
|
||||
return random.getrandbits(128)
|
||||
return sha3.keccak_256(hash_input).digest()
|
||||
|
||||
|
||||
def content_hash(hash_input):
|
||||
return random.getrandbits(128)
|
||||
return sha3.keccak_256(hash_input).digest()
|
|
@ -79,8 +79,9 @@ class Policy(object):
|
|||
return policy
|
||||
|
||||
def hash(self, pubkey_sig_alice, hash_input):
|
||||
hash_input = str(hash_input).encode()
|
||||
self.hashed_part = content_hash(hash_input)
|
||||
hash_input_for_id = (pubkey_sig_alice, self.hashed_part)
|
||||
hash_input_for_id = str(pubkey_sig_alice).encode() + str(self.hashed_part).encode()
|
||||
self.id = content_hash(hash_input_for_id)
|
||||
return self.id
|
||||
|
||||
|
|
Loading…
Reference in New Issue