From ad2ccff56025c4430936767481773de7abeebce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Borgstr=C3=B6m?= Date: Mon, 25 Oct 2010 19:52:12 +0200 Subject: [PATCH] Minor OAEP changes. --- dedupestore/oaep.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dedupestore/oaep.py b/dedupestore/oaep.py index 7bb25f217..069e3de33 100644 --- a/dedupestore/oaep.py +++ b/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:]