o �J�h��@sZddlmZddlZddlZddlZddlZddgZdZddd �Zdd d�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�NC:\pinokio\api\whisper-webui.git\app\env\lib\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 r r )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_intZ mask_repeatedZmask_intrrrr$s $)rr)r rrr)rrrrrr) � __future__rr rrr�__all__rrrrrrrr�<module>s   
Memory