소스 검색

Minor OAEP changes.

Jonas Borgström 14 년 전
부모
커밋
ad2ccff560
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      dedupestore/oaep.py

+ 3 - 3
dedupestore/oaep.py

@@ -1,10 +1,10 @@
-from operator import xor
 from Crypto.Util.number import long_to_bytes
 from Crypto.Hash import SHA
 
+from .helpers import IntegrityError
 
 def _xor_bytes(a, b):
-    return ''.join(chr(xor(ord(x[0]), ord(x[1]))) for x in zip(a, b))
+    return ''.join(chr(ord(x[0]) ^ ord(x[1])) for x in zip(a, b))
 
 
 def MGF1(seed, mask_len, hash=SHA):
@@ -51,7 +51,7 @@ class OAEP(object):
         if (ciphertext[0] != '\0' or
             label_hash != label_hash2 or
             data[0] != '\1'):
-            raise ValueError('decryption error')
+            raise IntegrityError('decryption error')
         return data[1:]