o
    ¢ØÆhà  ã                   @   sb   d dl mZmZ d dlmZ d dlmZmZ G dd„ deƒZG dd„ deƒZ	e	ƒ Z
e
jZe
jZdS )	é    )ÚUnionÚcast)Úkeccak)Ú
BackendAPIÚPreImageAPIc                   @   sH   e Zd Zdeddfdd„Zdeddfdd„Zdefdd	„Zdd
d„ZdS )ÚCryptodomePreimageÚprehashÚreturnNc                 C   s   t j|ddd�| _|g| _d S )Né   T)ÚdataÚdigest_bitsÚupdate_after_digest)r   ÚnewÚ_hashÚ_parts©Úselfr   © r   úk/var/www/html/HyperOracle/crypto_trader/venv/lib/python3.10/site-packages/eth_hash/backends/pycryptodome.pyÚ__init__   s   zCryptodomePreimage.__init__c                 C   s   | j  |¡ | j |¡ d S ©N)r   Úupdater   Úappendr   r   r   r   r      s   zCryptodomePreimage.updatec                 C   s   t t| j ¡ ƒS r   )r   Úbytesr   Údigest©r   r   r   r   r      ó   zCryptodomePreimage.digestc                 C   s   t d | j¡ƒS )Nó    )r   Újoinr   r   r   r   r   Úcopy   r   zCryptodomePreimage.copy)r	   r   )Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r   r   r   r      s
    r   c                   @   s@   e Zd Zdeeef defdd„Zdeeef defdd„ZdS )ÚCryptodomeBackendr   r	   c                 C   s   t j|dd�}tt| ¡ ƒS )Nr
   )r   r   )r   r   r   r   r   )r   r   Úhasherr   r   r   Ú	keccak256$   s   zCryptodomeBackend.keccak256c                 C   s   t |ƒS r   )r   r   r   r   r   Úpreimage(   s   zCryptodomeBackend.preimageN)	r    r!   r"   r   Ú	bytearrayr   r%   r   r&   r   r   r   r   r#   #   s    r#   N)Útypingr   r   ÚCrypto.Hashr   Úeth_hash.abcr   r   r   r#   Úbackendr%   r&   r   r   r   r   Ú<module>   s    	
