summaryrefslogtreecommitdiff
path: root/mail/src/leap
diff options
context:
space:
mode:
Diffstat (limited to 'mail/src/leap')
-rw-r--r--mail/src/leap/mail/adaptors/soledad.py3
-rw-r--r--mail/src/leap/mail/walk.py7
2 files changed, 6 insertions, 4 deletions
diff --git a/mail/src/leap/mail/adaptors/soledad.py b/mail/src/leap/mail/adaptors/soledad.py
index 7f2b1cf6..f4af020d 100644
--- a/mail/src/leap/mail/adaptors/soledad.py
+++ b/mail/src/leap/mail/adaptors/soledad.py
@@ -22,7 +22,6 @@ import re
from collections import defaultdict
from email import message_from_string
-from pycryptopp.hash import sha256
from twisted.internet import defer
from twisted.python import log
from zope.interface import implements
@@ -1208,7 +1207,7 @@ def _split_into_parts(raw):
def _parse_msg(raw):
msg = message_from_string(raw)
parts = walk.get_parts(msg)
- chash = sha256.SHA256(raw).hexdigest()
+ chash = walk.get_hash(raw)
multi = msg.is_multipart()
return msg, parts, chash, multi
diff --git a/mail/src/leap/mail/walk.py b/mail/src/leap/mail/walk.py
index 7be1bb87..8693bdd2 100644
--- a/mail/src/leap/mail/walk.py
+++ b/mail/src/leap/mail/walk.py
@@ -17,13 +17,16 @@
"""
Utilities for walking along a message tree.
"""
-from pycryptopp.hash import sha256
+from cryptography.hazmat.backends import default_backend
+from cryptography.hazmat.primitives import hashes
from leap.mail.utils import first
def get_hash(s):
- return sha256.SHA256(s).hexdigest()
+ digest = hashes.Hash(hashes.SHA256(), default_backend())
+ digest.update(s)
+ return digest.finalize().encode("hex").upper()
"""