mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-25 09:19:31 +00:00
Minor OAEP changes.
This commit is contained in:
parent
a8deb8c3b9
commit
ad2ccff560
1 changed files with 3 additions and 3 deletions
|
@ -1,10 +1,10 @@
|
||||||
from operator import xor
|
|
||||||
from Crypto.Util.number import long_to_bytes
|
from Crypto.Util.number import long_to_bytes
|
||||||
from Crypto.Hash import SHA
|
from Crypto.Hash import SHA
|
||||||
|
|
||||||
|
from .helpers import IntegrityError
|
||||||
|
|
||||||
def _xor_bytes(a, b):
|
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):
|
def MGF1(seed, mask_len, hash=SHA):
|
||||||
|
@ -51,7 +51,7 @@ def decode(self, ciphertext, label=''):
|
||||||
if (ciphertext[0] != '\0' or
|
if (ciphertext[0] != '\0' or
|
||||||
label_hash != label_hash2 or
|
label_hash != label_hash2 or
|
||||||
data[0] != '\1'):
|
data[0] != '\1'):
|
||||||
raise ValueError('decryption error')
|
raise IntegrityError('decryption error')
|
||||||
return data[1:]
|
return data[1:]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue