o
    LDi~                     @  sZ   d dl mZ d dlZd dlZd dlZd dlZddgZdZddd	ZdddZ	dddZ
dS )    )annotationsN
accept_key
apply_maskz$258EAFA5-E914-47DA-95CA-C5AB0DC85B11returnstrc                  C  s   t d} t|  S )zB
    Generate a random key for the Sec-WebSocket-Key header.

       )secretstoken_bytesbase64	b64encodedecode)key r   \/var/www/www-root/data/www/77.83.87.30/venv/lib/python3.10/site-packages/websockets/utils.pygenerate_key   s   
r   r   c                 C  s$   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
   r   r   )r   r   r   r   r   r      s   databytesmaskc                 C  sj   t |dkr
tdt| tj}|t | d  |dt | d   }t|tj}||A t | tjS )z
    Apply masking to the data of a WebSocket message.

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

       zmask must contain 4 bytesN)len
ValueErrorint
from_bytessys	byteorderto_bytes)r   r   data_intmask_repeatedmask_intr   r   r   r   $   s   	$)r   r   )r   r   r   r   )r   r   r   r   r   r   )
__future__r   r
   r   r   r   __all__r   r   r   r   r   r   r   r   <module>   s    

	