HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib/python3.10/site-packages/websockets/__pycache__/utils.cpython-310.pyc
o

�h~�@sZddlmZddlZddlZddlZddlZddgZdZddd	�Zddd�Z	ddd�Z
dS)�)�annotationsN�
accept_key�
apply_maskz$258EAFA5-E914-47DA-95CA-C5AB0DC85B11�return�strcCst�d�}t�|���S)zB
    Generate a random key for the Sec-WebSocket-Key header.

    �)�secrets�token_bytes�base64�	b64encode�decode)�key�r�C/usr/local/CyberCP/lib/python3.10/site-packages/websockets/utils.py�generate_keys
rr
cCs$t�|t�����}t�|���S)z
    Compute the value of the Sec-WebSocket-Accept header.

    Args:
        key: Value of the Sec-WebSocket-Key header.

    )�hashlib�sha1�GUID�encode�digestr
rr)r
rrrrrs�data�bytes�maskcCsjt|�dkr
td��t�|tj�}|t|�d|dt|�d�}t�|tj�}||A�t|�tj�S)z
    Apply masking to the data of a WebSocket message.

    Args:
        data: Data to mask.
        mask: 4-bytes mask.

    �zmask must contain 4 bytesN)�len�
ValueError�int�
from_bytes�sys�	byteorder�to_bytes)rr�data_int�
mask_repeated�mask_intrrrr$s	$)rr)r
rrr)rrrrrr)�
__future__rr
rrr�__all__rrrrrrrr�<module>s