%PDF- %PDF-
Direktori : /lib/python3/dist-packages/nacl/bindings/__pycache__/ |
Current File : //lib/python3/dist-packages/nacl/bindings/__pycache__/utils.cpython-312.pyc |
� �f� � � � d dl mZ d dlmZmZ d dl mZ dededefd�Z ded e defd �Zded e defd�Zdedefd �Z dededefd�Zy)� N)�ffi�lib)�ensure�inp1�inp2�returnc �( � t t | t � t j �� t t |t � t j �� t t | � t |� � }t j d|� }t j d|� }t j || t | � � t j ||t |� � t | � t |� k( }t j |||� dk( }|xr |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�eqCs �5/usr/lib/python3/dist-packages/nacl/bindings/utils.pyr r s� � � �:�d�E�"�C�M�M�:� �:�d�E�"�C�M�M�:� �S��Y��D� � "�B��7�7�9�b�!�D��7�7�9�b�!�D��K�K��d�C��I�&��K�K��d�C��I�&� �d�)�s�4�y� �C� � � �D�$�� +�q� 0�C��;�3�� �s� blocksizec � � t t | t � t j �� t t |t � t j �� |dk rt j �t | � }||z }t j d|� }t j dd� }t j || |� t j |||||� }t |dk( dt j �� t j ||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�rcs r r$ r$ ) s� � � �:�a������7� �:�i��%�s�}�}�=��A�~��n�n����F�E��I��E� �'�'�$�e� ,�C��G�G�K��#�E��K�K��Q��� ����s�E�9�e� <�B� �2��7�%�s���?��:�:�c�5��8�$�Q�'�'r c �\ � t t | t � t j �� t t |t � t j �� t | � }t j dd� }t j || ||� }|dk7 rt j 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"