Submit
Path:
~
/
/
usr
/
lib
/
python2.7
/
site-packages
/
passlib
/
tests
/
File Content:
test_handlers_scrypt.py
"""passlib.tests.test_handlers - tests for passlib hash algorithms""" #============================================================================= # imports #============================================================================= # core import logging; log = logging.getLogger(__name__) import warnings warnings.filterwarnings("ignore", ".*using builtin scrypt backend.*") # site # pkg from passlib import hash from passlib.tests.utils import HandlerCase, TEST_MODE from passlib.tests.test_handlers import UPASS_TABLE, PASS_TABLE_UTF8 # module #============================================================================= # scrypt hash #============================================================================= class _scrypt_test(HandlerCase): handler = hash.scrypt known_correct_hashes = [ # # excepted from test vectors from scrypt whitepaper # (http://www.tarsnap.com/scrypt/scrypt.pdf, appendix b), # and encoded using passlib's custom format # # salt=b"" ("", "$scrypt$ln=4,r=1,p=1$$d9ZXYjhleyA7GcpCwYoEl/FrSETjB0ro39/6P+3iFEI"), # salt=b"NaCl" ("password", "$scrypt$ln=10,r=8,p=16$TmFDbA$/bq+HJ00cgB4VucZDQHp/nxq18vII3gw53N2Y0s3MWI"), # # custom # # simple test ("test", '$scrypt$ln=8,r=8,p=1$wlhLyXmP8b53bm1NKYVQqg$mTpvG8lzuuDk+DWz8HZIB6Vum6erDuUm0As5yU+VxWA'), # different block value ("password", '$scrypt$ln=8,r=2,p=1$dO6d0xoDoLT2PofQGoNQag$g/Wf2A0vhHhaJM+addK61QPBthSmYB6uVTtQzh8CM3o'), # different rounds (UPASS_TABLE, '$scrypt$ln=7,r=8,p=1$jjGmtDamdA4BQAjBeA9BSA$OiWRHhQtpDx7M/793x6UXK14AD512jg/qNm/hkWZG4M'), # alt encoding (PASS_TABLE_UTF8, '$scrypt$ln=7,r=8,p=1$jjGmtDamdA4BQAjBeA9BSA$OiWRHhQtpDx7M/793x6UXK14AD512jg/qNm/hkWZG4M'), # diff block & parallel counts as well ("nacl", '$scrypt$ln=1,r=4,p=2$yhnD+J+Tci4lZCwFgHCuVQ$fAsEWmxSHuC0cHKMwKVFPzrQukgvK09Sj+NueTSxKds') ] if TEST_MODE("full"): # add some hashes with larger rounds value. known_correct_hashes.extend([ # # from scrypt whitepaper # # salt=b"SodiumChloride" ("pleaseletmein", "$scrypt$ln=14,r=8,p=1$U29kaXVtQ2hsb3JpZGU" "$cCO9yzr9c0hGHAbNgf046/2o+7qQT44+qbVD9lRdofI"), # # openwall format (https://gitlab.com/jas/scrypt-unix-crypt/blob/master/unix-scrypt.txt) # ("pleaseletmein", "$7$C6..../....SodiumChloride$kBGj9fHznVYFQMEn/qDCfrDevf9YDtcDdKvEqHJLV8D"), ]) known_malformed_hashes = [ # missing 'p' value '$scrypt$ln=10,r=1$wvif8/4fg1Cq9V7L2dv73w$bJcLia1lyfQ1X2x0xflehwVXPzWIUQWWdnlGwfVzBeQ', # rounds too low '$scrypt$ln=0,r=1,p=1$wvif8/4fg1Cq9V7L2dv73w$bJcLia1lyfQ1X2x0xflehwVXPzWIUQWWdnlGwfVzBeQ', # invalid block size '$scrypt$ln=10,r=A,p=1$wvif8/4fg1Cq9V7L2dv73w$bJcLia1lyfQ1X2x0xflehwVXPzWIUQWWdnlGwfVzBeQ', # r*p too large '$scrypt$ln=10,r=134217728,p=8$wvif8/4fg1Cq9V7L2dv73w$bJcLia1lyfQ1X2x0xflehwVXPzWIUQWWdnlGwfVzBeQ', ] def setUpWarnings(self): super(_scrypt_test, self).setUpWarnings() warnings.filterwarnings("ignore", ".*using builtin scrypt backend.*") def populate_settings(self, kwds): # builtin is still just way too slow. if self.backend == "builtin": kwds.setdefault("rounds", 6) super(_scrypt_test, self).populate_settings(kwds) class FuzzHashGenerator(HandlerCase.FuzzHashGenerator): def random_rounds(self): # decrease default rounds for fuzz testing to speed up volume. return self.randintgauss(4, 10, 6, 1) # create test cases for specific backends scrypt_scrypt_test = _scrypt_test.create_backend_case("scrypt") scrypt_builtin_test = _scrypt_test.create_backend_case("builtin") #============================================================================= # eof #=============================================================================
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
__init__.py
20 bytes
0644
__init__.pyc
181 bytes
0644
__init__.pyo
181 bytes
0644
__main__.py
82 bytes
0644
__main__.pyc
293 bytes
0644
__main__.pyo
293 bytes
0644
_test_bad_register.py
541 bytes
0644
_test_bad_register.pyc
919 bytes
0644
_test_bad_register.pyo
919 bytes
0644
backports.py
2513 bytes
0644
backports.pyc
1258 bytes
0644
backports.pyo
1258 bytes
0644
sample1.cfg
243 bytes
0644
sample1b.cfg
252 bytes
0644
sample1c.cfg
490 bytes
0644
sample_config_1s.cfg
238 bytes
0644
test_apache.py
25208 bytes
0644
test_apache.pyc
20198 bytes
0644
test_apache.pyo
20198 bytes
0644
test_apps.py
5281 bytes
0644
test_apps.pyc
5972 bytes
0644
test_apps.pyo
5972 bytes
0644
test_context.py
75039 bytes
0644
test_context.pyc
42392 bytes
0644
test_context.pyo
42392 bytes
0644
test_context_deprecated.py
29282 bytes
0644
test_context_deprecated.pyc
20648 bytes
0644
test_context_deprecated.pyo
20569 bytes
0644
test_crypto_builtin_md4.py
5660 bytes
0644
test_crypto_builtin_md4.pyc
6010 bytes
0644
test_crypto_builtin_md4.pyo
6010 bytes
0644
test_crypto_des.py
8874 bytes
0644
test_crypto_des.pyc
6692 bytes
0644
test_crypto_des.pyo
6692 bytes
0644
test_crypto_digest.py
18670 bytes
0644
test_crypto_digest.pyc
13552 bytes
0644
test_crypto_digest.pyo
13552 bytes
0644
test_crypto_scrypt.py
25655 bytes
0644
test_crypto_scrypt.pyc
21381 bytes
0644
test_crypto_scrypt.pyo
21302 bytes
0644
test_ext_django.py
32811 bytes
0644
test_ext_django.pyc
21620 bytes
0644
test_ext_django.pyo
21345 bytes
0644
test_ext_django_source.py
11034 bytes
0644
test_ext_django_source.pyc
7075 bytes
0644
test_ext_django_source.pyo
7028 bytes
0644
test_handlers.py
62786 bytes
0644
test_handlers.pyc
60928 bytes
0644
test_handlers.pyo
60928 bytes
0644
test_handlers_argon2.py
16951 bytes
0644
test_handlers_argon2.pyc
13606 bytes
0644
test_handlers_argon2.pyo
13514 bytes
0644
test_handlers_bcrypt.py
23507 bytes
0644
test_handlers_bcrypt.pyc
19655 bytes
0644
test_handlers_bcrypt.pyo
19493 bytes
0644
test_handlers_cisco.py
20471 bytes
0644
test_handlers_cisco.pyc
17618 bytes
0644
test_handlers_cisco.pyo
17618 bytes
0644
test_handlers_django.py
15109 bytes
0644
test_handlers_django.pyc
16025 bytes
0644
test_handlers_django.pyo
15911 bytes
0644
test_handlers_pbkdf2.py
18788 bytes
0644
test_handlers_pbkdf2.pyc
17158 bytes
0644
test_handlers_pbkdf2.pyo
17158 bytes
0644
test_handlers_scrypt.py
4124 bytes
0644
test_handlers_scrypt.pyc
4089 bytes
0644
test_handlers_scrypt.pyo
4089 bytes
0644
test_hosts.py
3906 bytes
0644
test_hosts.pyc
3852 bytes
0644
test_hosts.pyo
3852 bytes
0644
test_pwd.py
7190 bytes
0644
test_pwd.pyc
6456 bytes
0644
test_pwd.pyo
6456 bytes
0644
test_registry.py
9459 bytes
0644
test_registry.pyc
7715 bytes
0644
test_registry.pyo
7715 bytes
0644
test_totp.py
65562 bytes
0644
test_totp.pyc
40189 bytes
0644
test_totp.pyo
40005 bytes
0644
test_utils.py
40242 bytes
0644
test_utils.pyc
30495 bytes
0644
test_utils.pyo
30495 bytes
0644
test_utils_handlers.py
32134 bytes
0644
test_utils_handlers.pyc
29250 bytes
0644
test_utils_handlers.pyo
29188 bytes
0644
test_utils_md4.py
1474 bytes
0644
test_utils_md4.pyc
1588 bytes
0644
test_utils_md4.pyo
1588 bytes
0644
test_utils_pbkdf2.py
12108 bytes
0644
test_utils_pbkdf2.pyc
10552 bytes
0644
test_utils_pbkdf2.pyo
10552 bytes
0644
test_win32.py
1920 bytes
0644
test_win32.pyc
2030 bytes
0644
test_win32.pyo
2030 bytes
0644
tox_support.py
2473 bytes
0644
tox_support.pyc
2842 bytes
0644
tox_support.pyo
2842 bytes
0644
utils.py
138326 bytes
0644
utils.pyc
95162 bytes
0644
utils.pyo
94702 bytes
0644
N4ST4R_ID | Naxtarrr