From cdd25e3b0fbd661a9d78962344d0a1627f0276a1 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Mon, 11 Mar 2019 21:12:04 -0300 Subject: [PATCH] pylint --- torba/client/hash.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/torba/client/hash.py b/torba/client/hash.py index cb2a17696..e25bfff11 100644 --- a/torba/client/hash.py +++ b/torba/client/hash.py @@ -157,16 +157,16 @@ def better_aes_encrypt(secret: str, value: bytes) -> bytes: def better_aes_decrypt(secret: str, value: bytes) -> bytes: data = base64.b64decode(value) - type, n, r, p, data = data.split(b':', maxsplit=4) + _, scryp_n, scrypt_r, scrypt_p, data = data.split(b':', maxsplit=4) init_vector, data = data[:16], data[16:] - key = scrypt(secret.encode(), salt=init_vector, n=int(n), r=int(r), p=int(p)) + key = scrypt(secret.encode(), init_vector, int(scryp_n), int(scrypt_r), int(scrypt_p)) decryptor = Cipher(AES(key), modes.CBC(init_vector), default_backend()).decryptor() unpadder = PKCS7(AES.block_size).unpadder() return unpadder.update(decryptor.update(data)) + unpadder.finalize() -def scrypt(passphrase, salt, n=1<<13, r=16, p=1): - kdf = Scrypt(salt, length=32, n=n, r=r, p=p, backend=default_backend()) +def scrypt(passphrase, salt, scrypt_n=1<<13, scrypt_r=16, scrypt_p=1): + kdf = Scrypt(salt, length=32, n=scrypt_n, r=scrypt_r, p=scrypt_p, backend=default_backend()) return kdf.derive(passphrase)