directories: make the IV for the writecaps in directory entries be computed from the secure hash of the writecap itself

This makes encoding of directory entries deterministic, and it is also a tad faster on Macbook Pro than getting a random IV with os.urandom(16).
This commit is contained in:
Zooko O'Whielacronx
2009-07-04 19:48:15 -07:00
parent fcedca966e
commit 786ed012b3
2 changed files with 5 additions and 1 deletions

View File

@ -195,7 +195,7 @@ class NewDirectoryNode:
def _encrypt_rwcap(self, rwcap):
assert isinstance(rwcap, str)
IV = os.urandom(16)
IV = hashutil.mutable_rwcap_iv_hash(self._node.get_writekey())
key = hashutil.mutable_rwcap_key_hash(IV, self._node.get_writekey())
cryptor = AES(key)
crypttext = cryptor.process(rwcap)