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/pymacaroons/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

�%�Y��@s�ddlZddlmZddlZddlZddlmZmZdd�Zdd�Z	d"dd	�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�ZdS)#�N)�sha256)�	text_type�binary_typecCs6|durdSt|t�r|�d�St|t�r|Std���N�utf-8z!Must be a string or bytes object.)�
isinstancer�encoder�	TypeError��string_or_bytes�r�3/usr/lib/python3/dist-packages/pymacaroons/utils.py�convert_to_bytes	s


rcCs6|durdSt|t�r
|St|t�r|�d�Std��r)rrr�decoder	r
rrr
�convert_to_strings


rcCsT|durd}t|�}t|�}||krt|d|��S||kr(t|d||�S|S)N� �)�	bytearray�len�bytes)�byte_string�size�
byte_array�lengthrrr
�truncate_or_padsrcCs
td|�S)Nsmacaroons-key-generator)�hmac_digest)�keyrrr
�generate_derived_key,�
rcCstj||td���S)N)�msg�	digestmod)�hmac�newr�digest)r�datarrr
r0s��rcCst||�}t�|�S�N)r�binascii�hexlify)rr$�digrrr
�hmac_hex8s

r)cCst|�}t||�Sr%)rr))r�
identifier�derived_keyrrr
�create_initial_signature=s
r,cCs"t||�}t||�}t|||�Sr%)rr))r�data1�data2�hash1�hash2rrr
�hmac_concatBs

r1cCs
t||�Sr%)r))�	signature�	predicaterrr
�sign_first_party_caveatHrr4cCst|||�Sr%)r1)r2�verification_id�	caveat_idrrr
�sign_third_party_caveatLsr7cCsHt|�t|�kr
dSd}t||�D]\}}|t|�t|�AO}q|dkS)aE
    Returns True if the two strings are equal, False otherwise.

    The time taken is independent of the number of characters that match.

    For the sake of simplicity, this function executes in constant time only
    when the two strings have the same length. It short-circuits when they
    have different lengths.
    Fr)r�zip�ord)�val1�val2�result�x�yrrr
�equalsPs
r?cCs|dt|�dS)z�Add padding to base64 encoded bytes.

    Padding can be removed when sending the messages.

    @param b bytes to be padded.
    @return a padded bytes.
    �=�)r��brrr
�add_base64_paddingbsrDcCs
	t|�Sr%)�raw_urlsafe_b64decode�base64�	b64decoderD��srrr
�
raw_b64decodemsrJcCst�t|�d���S)ztBase64 decode with added padding and conversion to bytes.

    @param s string decode
    @return bytes decoded
    r)rF�urlsafe_b64decoderDrrHrrr
rEtsrEcCst�|��d�S)z^Base64 encode with padding removed.

    @param s string decode
    @return bytes decoded
    r@)rF�urlsafe_b64encode�rstriprBrrr
�raw_urlsafe_b64encode}srNr%)rF�hashlibrr!r&�sixrrrrrrrr)r,r1r4r7r?rDrJrErNrrrr
�<module>s(

	

https://t.me/RX1948 - 2025