
    vKg~                    Z    S SK Jr  S SKrS SKrS SKrS SKrSS/rSrS	S jrS
S jr	SS jr
g)    )annotationsN
accept_key
apply_maskz$258EAFA5-E914-47DA-95CA-C5AB0DC85B11c                 v    [         R                  " S5      n [        R                  " U 5      R	                  5       $ )z:
Generate a random key for the Sec-WebSocket-Key header.

   )secretstoken_bytesbase64	b64encodedecode)keys    P/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/websockets/utils.pygenerate_keyr      s.    
 

b
!CC ''))    c                    [         R                  " U [        -   R                  5       5      R	                  5       n[
        R                  " U5      R                  5       $ )zo
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   s     r   r   r      sB     <<t++-.557DD!((**r   c                b   [        U5      S:w  a  [        S5      e[        R                  U [        R
                  5      nU[        U 5      S-  -  US[        U 5      S-   -   n[        R                  U[        R
                  5      nX$-  R                  [        U 5      [        R
                  5      $ )zk
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)datamaskdata_intmask_repeatedmask_ints        r   r   r   $   s     4yA~455~~dCMM2HCIN+d?SY].CCM~~mS]];H))#d)S]]CCr   )returnstr)r   r&   r%   r&   )r    bytesr!   r'   r%   r'   )
__future__r   r
   r   r   r   __all__r   r   r   r    r   r   <module>r+      s7    "    
 
& .*	+Dr   