Author: Carl Friedrich Bolz <[email protected]>
Branch: py3.5
Changeset: r88295:38b208bbc61c
Date: 2016-11-10 17:40 +0100
http://bitbucket.org/pypy/pypy/changeset/38b208bbc61c/
Log: match CPython3's pbkdf2_hmac behaviour about the password and salt
arguments
diff --git a/pypy/module/_hashlib/interp_hashlib.py
b/pypy/module/_hashlib/interp_hashlib.py
--- a/pypy/module/_hashlib/interp_hashlib.py
+++ b/pypy/module/_hashlib/interp_hashlib.py
@@ -187,7 +187,7 @@
HAS_FAST_PKCS5_PBKDF2_HMAC = ropenssl.PKCS5_PBKDF2_HMAC is not None
if HAS_FAST_PKCS5_PBKDF2_HMAC:
- @unwrap_spec(name=str, password=str, salt=str, rounds=int,
+ @unwrap_spec(name=str, password='bytes', salt='bytes', rounds=int,
w_dklen=WrappedDefault(None))
def pbkdf2_hmac(space, name, password, salt, rounds, w_dklen):
digest = ropenssl.EVP_get_digestbyname(name)
diff --git a/pypy/module/_hashlib/test/test_hashlib.py
b/pypy/module/_hashlib/test/test_hashlib.py
--- a/pypy/module/_hashlib/test/test_hashlib.py
+++ b/pypy/module/_hashlib/test/test_hashlib.py
@@ -91,7 +91,9 @@
from _hashlib import pbkdf2_hmac
except ImportError:
skip("Requires OpenSSL >= 1.1")
- out = pbkdf2_hmac('sha1', 'password', 'salt', 1)
+ out = pbkdf2_hmac('sha1', b'password', b'salt', 1)
assert out == '0c60c80f961f0e71f3a9b524af6012062fe037a6'.decode('hex')
- out = pbkdf2_hmac('sha1', 'password', 'salt', 2, None)
+ out = pbkdf2_hmac('sha1', b'password', b'salt', 2, None)
assert out == 'ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957'.decode('hex')
+ raises(TypeError, pbkdf2_hmac, 'sha1', 'password', b'salt', 1)
+ raises(TypeError, pbkdf2_hmac, 'sha1', b'password', 'salt', 1)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit