| Server IP : 157.22.201.140 / Your IP : 216.73.216.74 Web Server : nginx/1.30.1 System : Linux mit.vincode.fvds.ru 6.8.0-111-generic #111-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 11 23:16:02 UTC 2026 x86_64 User : root ( 0) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/passlib/handlers/__pycache__/ |
Upload File : |
�
`Άe� �
�� � d Z ddlmZ ddlmZ ddlZddlZddlZ ej e � Z
ddlmZ da
dadadaddlmZ ddlmZmZmZ ddlmZmZmZmZmZmZmZmZm Z m!Z!m"Z" dd l#m$Z$ dd
l%m&Z& ddl%m'Z'm(Z(m)Z)m*Z*m+Z+m,Z, ddl-m.c m/Z0 dgZ1 e'd
� Z2 e'd� Z3 e'd� Z4 e'd� Z5 e'd� Z6dZ7dZ8d� Z9 G d� de0jt e0jv e0jx e0jz e0j| e0j~ � Z@ G d� de@� ZA G d� de@� ZB G d� de@� ZC G d� de@� ZD G d� d e@� ZE G d!� d"e@� ZF G d#� deAe@� ZG e'd$� ZH G d%� d&eG� ZI G d'� d(eI� ZJy))z�passlib.bcrypt -- implementation of OpenBSD's BCrypt algorithm.
TODO:
* support 2x and altered-2a hashes?
http://www.openwall.com/lists/oss-security/2011/06/27/9
* deal with lack of PY3-compatibile c-ext implementation
� )� b64encode)�sha256N)�warn)�compile_hmac)�PasslibHashWarning�PasslibSecurityWarning�PasslibSecurityError)�
safe_crypt�
repeat_string�to_bytes�
parse_version�rng�
getrandstr�
test_crypt�
to_unicode�
utf8_truncate�utf8_repeat_string�crypt_accepts_bytes)�bcrypt64)�get_unbound_method_function)�u�
uascii_to_str�unicode�
str_to_uascii�PY3�
error_from�bcryptz$2$z$2a$z$2x$z$2y$z$2b$� z<$2a$04$5BJqKfqMQvV7nS.yUguNcueVirQqDBGaLXSqj.rs.pZPlNR0UX/HKc �X � ddl } ddlm} y# t $ r Y yw xY w# t $ r Y yw xY w)a!
internal helper which tries to distinguish pybcrypt vs bcrypt.
:returns:
True if cext-based py-bcrypt,
False if ffi-based bcrypt,
None if 'bcrypt' module not found.
.. versionchanged:: 1.6.3
Now assuming bcrypt installed, unless py-bcrypt explicitly detected.
Previous releases assumed py-bcrypt by default.
Making this change since py-bcrypt is (apparently) unmaintained and static,
whereas bcrypt is being actively maintained, and it's internal structure may shift.
r N)�__version__FT)r �ImportError�bcrypt._bcryptr )r r s �9/usr/lib/python3/dist-packages/passlib/handlers/bcrypt.py�_detect_pybcryptr$ 6 s@ � �(���.� �� � � ��� � ���s � � � �� )�)c � � � e Zd ZdZdZdZdZej Z e
Zee
eee
fZ ed� e ed� e
ed� e ed� e
iZd xZZej Zd
ZdZdZdZd
ZdZdZdZdZdZdZ e
Z!dZ"e#d� � Z$d� Z%d� Z&e#� fd�� Z'e#d� � Z(e#� fd�� Z)e#� fd�� Z*d� fd� Z+dZ,e#d� � Z-d� Z.e#dd�� Z/� xZ0S )�
_BcryptCommona&
Base class which implements brunt of BCrypt code.
This is then subclassed by the various backends,
to override w/ backend-specific methods.
When a backend is loaded, the bases of the 'bcrypt' class proper
are modified to prepend the correct backend-specific subclass.
r )�salt�rounds�ident�truncate_error� �2�2a�2y�2b� z.Oeu� � �log2�H Fc �: � | j |� \ }}|t k( rt d� �|j t d� � \ }}t |� }|t d� |fz k7 r t j j | d� �|d d |dd }} | |||xs d |�� S )Nz>crypt_blowfish's buggy '2x' hashes are not currently supported�$z%02dzmalformed cost fieldr0 )r( r'