diff options
author | drebs <drebs@leap.se> | 2013-04-25 14:48:48 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2013-04-25 14:48:48 -0300 |
commit | 34130c581ce84d89b0d52f7274d8ade3457e1ff9 (patch) | |
tree | 64c46e878ce438d29e30667a8f3d78e88293a3d0 /src/leap | |
parent | 000639eeb664c476d1cea3fe7056db94caa093c0 (diff) |
Remove base64 encoding of hashes.
Diffstat (limited to 'src/leap')
-rw-r--r-- | src/leap/soledad/__init__.py | 5 | ||||
-rw-r--r-- | src/leap/soledad/crypto.py | 4 |
2 files changed, 3 insertions, 6 deletions
diff --git a/src/leap/soledad/__init__.py b/src/leap/soledad/__init__.py index 23d81e84..ea8c895e 100644 --- a/src/leap/soledad/__init__.py +++ b/src/leap/soledad/__init__.py @@ -38,7 +38,6 @@ except ImportError: import json # noqa -from binascii import b2a_base64 from hashlib import sha256 @@ -51,6 +50,7 @@ from leap.soledad.backends.leap_backend import ( LeapSyncTarget, ) from leap.soledad.shared_db import SoledadSharedDatabase +from leap.soledad.crypto import SoledadCrypto class KeyDoesNotExist(Exception): @@ -382,8 +382,7 @@ class Soledad(object): @return: the hash @rtype: str """ - return b2a_base64( - sha256('address-%s' % self._address).digest())[:-1] + return sha256('address-%s' % self._address).hexdigest() def _fetch_keys_from_shared_db(self): """ diff --git a/src/leap/soledad/crypto.py b/src/leap/soledad/crypto.py index dcc40439..c956f602 100644 --- a/src/leap/soledad/crypto.py +++ b/src/leap/soledad/crypto.py @@ -21,7 +21,6 @@ Cryptographic utilities for Soledad. """ -from binascii import b2a_base64 from hashlib import sha256 @@ -154,8 +153,7 @@ class SoledadCrypto(object): """ if self._symkey is None: raise NoSymmetricSecret() - return b2a_base64( - sha256('%s%s' % (self._symkey, suffix)).digest())[:-1] + return sha256('%s%s' % (self._symkey, suffix)).hexdigest() # # symkey setters/getters |