HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //proc/thread-self/root/usr/local/lib/python3.7/test/__pycache__/test_crypt.cpython-37.opt-2.pyc
B

��g�@sLddlZddlmZddlZe�d�ZGdd�dej�ZedkrHe�	�dS)�N)�support�cryptc@sxeZdZdd�Zdd�Zdd�Zdd�Ze�e	j
e	jkpBe	je	jkd	�d
d��Z
e�e	je	jkd�d
d��Zdd�ZdS)�
CryptTestCasecCsRt�d�}t�d|�}|�||�t�dd�}|dk	rNt�d|�}|�||�dS)N�
mypasswordZab)r�assertEqual)�self�cr�cr2�r
�+/usr/local/lib/python3.7/test/test_crypt.py�
test_crypt	s
zCryptTestCase.test_cryptc
Csx|�ttj�d�x`tjD]V}t�|�}|�t|�|jddddddh�|jr|�|j|dt|�|j��qWdS)N�@r�����)	r�lenrZ
_saltchars�methods�mksalt�assertIn�
salt_charsZident)r�method�saltr
r
r�	test_salts
"zCryptTestCase.test_saltcCsnxhtjD]^}t�d|�}|�t|�|j�t�d|�}|�||�t�dt�|��}|�t|�|j�qWdS)NZassword)rrrrZ
total_sizer)rrrr	r
r
r�test_saltedcryptszCryptTestCase.test_saltedcryptcCsL|�ttj�dk�tj�d�r4|�tjtjg�n|�tjdtj	�dS)NrZopenbsd���)
�
assertTruerrr�sys�platform�
startswithr�METHOD_BLOWFISH�METHOD_CRYPT)rr
r
r�test_methods#szCryptTestCase.test_methodszrequires support of SHA-2c	Cs�x�tjtjfD]�}xzdD]r}tj||d�}|�d||�|�t|�|jdtt|���t�d|�}|�	|�t�d|�}|�||�qWqWdS)N)i�i'i��)�roundsz$rounds=%d$�r)
r�
METHOD_SHA256�
METHOD_SHA512rrrrr�strr)rrr$rrr	r
r
r�test_sha2_rounds*s

zCryptTestCase.test_sha2_roundszrequires support of BlowfishcCs�x�tdd�D]r}tjtjd|>d�}|�d||�|�t|�tjjddh�t�d|�}|�|�t�d|�}|�||�qWdS)	Nrr%r)r$z$%02d$rrr)	�rangerrr!rrrrr)rZ
log_roundsrrr	r
r
r�test_blowfish_rounds9s
z"CryptTestCase.test_blowfish_roundscCsx�tjtjtjfD]�}|�t��tj|dd�WdQRX|�t��tj|dd�WdQRXx<ddddd>fD](}|�t��tj||d�WdQRXqpWqW|�t��tjtjdd�WdQRXx:tjtj	fD]*}|�
td	��tj|d
d�WdQRXq�WdS)NZ4096)r$g�@rrri�i�ri)rr&r'r!ZassertRaises�	TypeErrorr�
ValueErrorr"Z
METHOD_MD5ZassertRaisesRegex)rrr$r
r
r�test_invalid_roundsEs
 z!CryptTestCase.test_invalid_roundsN)�__name__�
__module__�__qualname__rrrr#�unittestZ
skipUnlessrr&rr'r)r!r+r.r
r
r
rrs		

r�__main__)
rZtestrr2�
import_modulerZTestCaserr/�mainr
r
r
r�<module>s
O