https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/nacl/bindings/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/nacl/bindings/__pycache__/utils.cpython-310.pyc
o

��a��@s�ddlmZddlmZmZddlmZdededefdd�Z	d	ed
e
defdd�Zd	ed
e
defd
d�Zdedefdd�Z
dededefdd�ZdS)�N)�ffi�lib)�ensure�inp1�inp2�returncCs�tt|t�tjd�tt|t�tjd�tt|�t|��}t�d|�}t�d|�}t�	||t|��t�	||t|��t|�t|�k}t
�|||�dk}|oO|S)zA
    Compare contents of two memory regions in constant time
    ��raisingzchar []r)r�
isinstance�bytes�exc�	TypeError�max�lenr�new�memmover�
sodium_memcmp)rr�ln�buf1�buf2�eqL�eqC�r�5/usr/lib/python3/dist-packages/nacl/bindings/utils.pyrsr�s�	blocksizecCs�tt|t�tjd�tt|t�tjd�|dkrtj�t|�}||}t�	d|�}t�	dd�}t�
|||�t�|||||�}t|dkdtj
d�t�||d�dd�S)z�
    Pad the input bytearray ``s`` to a multiple of ``blocksize``
    using the ISO/IEC 7816-4 algorithm

    :param s: input bytes string
    :type s: bytes
    :param blocksize:
    :type blocksize: int
    :return: padded string
    :rtype: bytes
    rr�unsigned char []�	size_t []�zPadding failureN)rr
rrr
�int�
ValueErrorrrrrr�
sodium_pad�CryptoError�buffer)rr�s_len�m_len�buf�p_len�rcrrrr!)sr!cCsntt|t�tjd�tt|t�tjd�t|�}t�dd�}t	�
||||�}|dkr/t�d��|d|d�S)z�
    Remove ISO/IEC 7816-4 padding from the input byte array ``s``

    :param s: input bytes string
    :type s: bytes
    :param blocksize:
    :type blocksize: int
    :return: unpadded string
    :rtype: bytes
    rrrrzUnpadding failureN)rr
rrr
rrrrr�sodium_unpadr")rrr$�u_lenr(rrrr)Cs
r)�inpcCsVtt|t�tjd�t|�}t�d|�}t�|||�t	�
||�t�||�dd�S)ag
    Increment the value of a byte-sequence interpreted
    as the little-endian representation of a unsigned big integer.

    :param inp: input bytes buffer
    :type inp: bytes
    :return: a byte-sequence representing, as a little-endian
             unsigned big integer, the value ``to_int(inp)``
             incremented by one.
    :rtype: bytes

    rrN)rr
rrr
rrrrr�sodium_incrementr#)r+rr&rrrr,Xs
r,�a�bcCs�tt|t�tjd�tt|t�tjd�t|�}tt|�|ktjd�t�d|�}t�d|�}t�|||�t�|||�t	�
|||�t�||�dd�S)a
    Given a couple of *same-sized* byte sequences, interpreted as the
    little-endian representation of two unsigned integers, compute
    the modular addition of the represented values, in constant time for
    a given common length of the byte sequences.

    :param a: input bytes buffer
    :type a: bytes
    :param b: input bytes buffer
    :type b: bytes
    :return: a byte-sequence representing, as a little-endian big integer,
             the integer value of ``(to_int(a) + to_int(b)) mod 2^(8*len(a))``
    :rtype: bytes
    rrN)rr
rrr
rrrrr�
sodium_addr#)r-r.r�buf_a�buf_brrrr/qsr/)�nacl.exceptions�
exceptionsr�nacl._sodiumrrrr�boolrrr!r)r,r/rrrr�<module>s

https://t.me/RX1948 - 2025