| Server IP : 93.86.61.54 / Your IP : 216.73.216.60 Web Server : Apache/2.4.62 (Ubuntu) System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64 User : www-data ( 33) PHP Version : 8.4.22 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3/dist-packages/nacl/bindings/__pycache__/ |
Upload File : |
o
��a� � @ s� d dl mZ d dlmZmZ d dl mZ dededefdd�Z d ed
e
defdd�Zd ed
e
defd
d�Zdedefdd�Z
dededefdd�ZdS )� N)�ffi�lib)�ensure�inp1�inp2�returnc C s� t t| t�tjd� t t|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)r r �ln�buf1�buf2�eqL�eqC� r �5/usr/lib/python3/dist-packages/nacl/bindings/utils.pyr s r �s� blocksizec C s� t t| t�tjd� t t|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
r r �unsigned char []� size_t []� zPadding failureN)r r
r r r
�int�
ValueErrorr r r r r �
sodium_pad�CryptoError�buffer)r r �s_len�m_len�buf�p_len�rcr r r r! ) s r! c C sn t t| t�tjd� t t|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
r r r r zUnpadding failureN)r r
r r r
r r r r r �sodium_unpadr"