a
    _mg                     @   s,  zd dl ZW n ey&   d dlZY n0 d dlZzd dlmZ dZW n> ey   zd dlmZ dZW n ey|   dZY n0 Y n0 ddlm	Z	 ddl
mZmZ g dZejd	ed
d ZG dd dejZejjedkdddd Zg dZejdedd Zg dZejdedd ZdS )    N)mpzTF   )	shake_256)bytes_to_intint_to_bytes))    bigr   )r   little   )    r   r   )    r	   r   zbytes_in,endian,int_outc                 C   s   t | |}||ksJ d S N)r   )Zbytes_inendianZint_outout r   F/var/www/html/idle/venv/lib/python3.9/site-packages/ecdsa/test_sha3.pytest_bytes_to_int   s    
r   c                   @   s   e Zd Zdd Zdd ZdS )TestBytesToIntc                 C   s8   |  t tdd W d    n1 s*0    Y  d S )Nr   middle)assertRaises
ValueErrorr   selfr   r   r   test_bytes_to_int_wrong_endian%   s    z-TestBytesToInt.test_bytes_to_int_wrong_endianc                 C   s:   |  t tddd W d    n1 s,0    Y  d S )Nr   r   )	byteorder)r   r   r   r   r   r   r   test_int_to_bytes_wrong_endian)   s    z-TestBytesToInt.test_int_to_bytes_wrong_endianN)__name__
__module____qualname__r   r   r   r   r   r   r   $   s   r   zrequires gmpy or gmpy2)reasonc                   C   s   t tddksJ d S )Nr      )r   r   r   r   r   r   test_int_to_bytes_with_gmpy.   s    r!   ))r   Nr   r   )r   r   r   r   )r   Nr   r    )r
   Nr	   r   )r
      r	   s      )r   r"   r   s      zint_in,length,endian,bytes_outc                 C   s   t | ||}||ksJ d S r   )r   )Zint_inlengthr   Z	bytes_outr   r   r   r   test_int_to_bytes=   s    r$   ))s   Message.    s    x73rO9CNrv.4L%O,:)r   r%   s    F+#;?t>$?Rb'dnv/)   messager%   s    ص-CnQZd&f
FQu)r&      s   ص-CnQ)r&   @   s@   ص-CnQZd&f
FQu0ֺ*Feb%&>e:Fl})s   AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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portErrorZpytestZgmpy2r   ZGMPYZgmpy_sha3r   Z_compatr   r   ZB2I_VECTORSmarkZparametrizer   ZTestCaser   Zskipifr!   ZI2B_VECTORSr$   ZSHAKE_256_VECTORSr+   r   r   r   r   <module>   s6   




)