Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
low_level.cpython-313.pyc154 linesDownload Raw Back to __pycache__
1�

2��j���SrSSKJr SSKJr SSKJrJr SSKJ	r	J3r4 SSKJrJ
r
Jr /SQr\5R r"S	S6\5r\4SSjjr\4SSjjrSS
jrSSjrSSjrg)a>7Low-level functions if you want to build your own higher level abstractions.8 9.. warning::10    This is a "Hazardous Materials" module.  You should **ONLY** use it if11    you're 100% absolutely sure that you know what you're doing because this12    module is full of land mines, dragons, and dinosaurs with laser guns.13�)�annotations)�Enum)�Any�Literal)�ffi�lib�)�HashingError�VerificationError�VerifyMismatchError)�ARGON2_VERSION�Typer�hash_secret�hash_secret_raw�
verify_secretc�`�\rSrSrSr\Rr\Rr	\RrSrg)r�(zL14Enum of Argon2 variants.15 16Please see :doc:`parameters` on how to pick one.17�N)
�__name__�18__module__�__qualname__�__firstlineno__�__doc__r�Argon2_d�D�Argon2_i�I�	Argon2_id�ID�__static_attributes__r��VD:\code\apps\devtools\python\user_packages\Python313\site-packages\argon2/low_level.pyrr(s$���	���A����A�	���Br!rc���[R"UUU[U5UUR5S-n[R19"SU5n	[R"UUU[R20"SU5[U5[R21"SU5[U5[RUU	UURU5
n22U23[R:wa[[U2455e[R"U	5$)ae25Hash *secret* and return an **encoded** hash.26 27An encoded hash can be directly passed into :func:`verify_secret` as it28contains all parameters and the salt.29 30Args:31    secret: Secret to hash.32 33    salt: A salt_. Should be random and different for each secret.34 35    type: Which Argon2 variant to use.36 37    version: Which Argon2 version to use.38 39For an explanation of the Argon2 parameters see40:class:`argon2.PasswordHasher`.41 42Returns:43    An encoded Argon2 hash.44 45Raises:46    argon2.exceptions.HashingError: If hashing fails.47 48.. versionadded:: 16.0.049 50.. _salt: https://en.wikipedia.org/wiki/Salt_(cryptography)51r	�char[]�	uint8_t[])r�argon2_encodedlen�len�valuer�new�argon2_hash�NULL�	ARGON2_OKr52�error_to_str�string)�secret�salt�	time_cost�memory_cost�parallelism�hash_len�type�version�size�buf�rvs           r"rr4s���N	��������I���J�J�
	53��	�	��'�'�(�D�54!�C�	����������V�$��F������T�"��D�	��������55�56��57�B�58�S�]�]���<��+�,�,��:�:�c�?�r!c��[R"SU5n[R"UUU[R"SU5[	U5[R"SU5[	U5UU[R59SURU5
n	U	[R:wa[[U	55e[[R"X�55$)z�60Hash *password* and return a **raw** hash.61 62This function takes the same parameters as :func:`hash_secret`.63 64.. versionadded:: 16.0.065r%r)rr)rr*r'r+r(r,r66r-�bytes�buffer)67r/r0r1r2r3r4r5r6r8r9s68          r"rr{s���"�'�'�+�x�69(�C�	����������V�$��F������T�"��D�	������	��70�71��72�B�73�S�]�]���<��+�,�,�����C�*�+�+r!c�P�[R"[R"SU5[R"SU5[	U5UR745nU[R:XagU[R:Xa[[U55e[[U55e)a�75Verify whether *secret* is correct for *hash* of *type*.76 77Args:78    hash:79        An encoded Argon2 hash as returned by :func:`hash_secret`.80 81    secret:82        The secret to verify whether it matches the one in *hash*.83 84    type: Type for *hash*.85 86Raises:87    argon2.exceptions.VerifyMismatchError:88        If verification fails because *hash* is not valid for *secret* of89        *type*.90 91    argon2.exceptions.VerificationError:92        If verification fails for other reasons.93 94Returns:95    ``True`` on success, raise :exc:`~argon2.exceptions.VerificationError`96    otherwise.97 98.. versionadded:: 16.0.099.. versionchanged:: 16.1.0100    Raise :exc:`~argon2.exceptions.VerifyMismatchError` on mismatches101    instead of its more generic superclass.102r$r%T)r�
argon2_verifyrr)r'r(r,�ARGON2_VERIFY_MISMATCHrr-r)�hashr/r5r9s    r"rr�s}��<103
�	�	�����$������V�$��F���104�105�	106�B�107�S�]�]���	�S�
'�
'�'�!�,�r�"2�3�3�108�L��,�109-�-r!c�.�[R"X5$)aR110Direct binding to the ``argon2_ctx`` function.111 112.. warning::113    This is a strictly advanced function working on raw C data structures.114    Both Argon2's and *argon2-cffi*'s higher-level bindings do a lot of115    sanity checks and housekeeping work that *you* are now responsible for116    (e.g. clearing buffers). The structure of the *context* object can,117    has, and will change with *any* release!118 119    Use at your own peril; *argon2-cffi* does *not* use this binding120    itself.121 122Args:123    context:124        A CFFI Argon2 context object (i.e. an ``struct Argon2_Context`` /125        ``argon2_context``).126 127    type:128        Which Argon2 variant to use.  You can use the ``value`` field of129        :class:`Type`'s fields.130 131Returns:132    An Argon2 error code.  Can be transformed into a string using133    :func:`error_to_str`.134 135.. versionadded:: 16.0.0136)r�137argon2_ctx)�contextr5s  r"�corerD�s��:�>�>�'�(�(r!c�t�[R"[R"U55R	S5$)z�138Convert an Argon2 error code into a native string.139 140Args:141    error: An Argon2 error code as returned by :func:`core`.142 143Returns:144    A human-readable string describing the error.145 146.. versionadded:: 16.0.0147�ascii)rr.r�argon2_error_message�decode)�errors r"r-r-�s)���:�:�c�.�.�u�5�6�=�=�g�F�Fr!N)r/r;r0r;r1�intr2rJr3rJr4rJr5rr6rJ�returnr;)r@r;r/r;r5rrKz
Literal[True])rCrr5rJrKrJ)rIrJrK�str)r�148__future__r�enumr�typingrr�_argon2_cffi_bindingsrr�149exceptionsr150rr�__all__�ARGON2_VERSION_NUMBERr
rrrrrDr-rr!r"�<module>rTs!���#���*�L�L����*�*���	�4�	�("�D��D�151�D��D��	D�152�D��
D��D��D��D�^"�%,��%,�153�%,��%,��	%,�154�%,��
%,��%,��%,��%,�P+.�\)�@Gr!
codekingpro/portable-devtools · Team Ai