o
    ‡®f¡  ã                   @   s"   d Z ddlmZ G dd„ dƒZdS )z‚ Python implementation of Arcfour encryption algorithm.
See https://en.wikipedia.org/wiki/RC4
This code is in the public domain.

é    )ÚSequencec                   @   s<   e Zd Zdee ddfdd„Zdedefdd„Ze ZZ	dS )	ÚArcfourÚkeyÚreturnNc                 C   sx   dd„ t dƒD ƒ}d}t|ƒ}t dƒD ]}|||  |||   d }|| || ||< ||< q|| _d\| _| _d S )Nc                 S   s   g | ]}|‘qS © r   )Ú.0Úir   r   úI/home/ubuntu/webapp/venv/lib/python3.10/site-packages/pdfminer/arcfour.pyÚ
<listcomp>   s    z$Arcfour.__init__.<locals>.<listcomp>é   r   )r   r   )ÚrangeÚlenÚsr   Új)Úselfr   r   r   Úklenr   r   r   r	   Ú__init__   s   zArcfour.__init__Údatac                 C   s˜   | j | j}}| j}d}t|ƒD ]2}|d d }|||  d }|| || ||< ||< ||| ||  d  }|t||A fƒ7 }q||| _ | _|S )Nó    é   r   )r   r   r   ÚiterÚbytes)r   r   r   r   r   ÚrÚcÚkr   r   r	   Úprocess   s   zArcfour.process)
Ú__name__Ú
__module__Ú__qualname__r   Úintr   r   r   ÚencryptÚdecryptr   r   r   r	   r      s    r   N)Ú__doc__Útypingr   r   r   r   r   r	   Ú<module>   s    