관리-도구
편집 파일: SecretSharing.cpython-311.pyc
� �k��}��� �~ � d dl mZ d dlmZ d dlmZmZ d dlmZ d� Z d� Z G d� de� � Z G d � d e� � ZdS )� )� is_native_int)�number)� long_to_bytes� bytes_to_long)�get_random_bytesc �N � || k r|| }} d}|r|dz r|| z }| dz } |dz }|�|S )z!Multiply two polynomials in GF(2)r � � )�f1�f2�zs �/builddir/build/BUILD/imunify360-venv-2.5.2/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Protocol/SecretSharing.py� _mult_gf2r ( s[ � � �B�w�w��R�B�� �A� � � ��6� � ��G�A� �q��� �q��� � � �H� c �� � | |k rd| fS t j }d}| } ||� � } ||� � |k r8d ||� � |z z }||z }|t ||� � z } ||� � |k �8||fS )z� Compute division of polynomials over GF(2). Given a and b, it finds two polynomials q and r such that: a = b*q + r with deg(r)<deg(b) r r )r �sizer )�a�b�deg�q�r�d�ss r �_div_gf2r 7 s� � � �A����!�t�� �+�C� �A� �A���A���A� �#�a�&�&�A�+�+� �#�#�a�&�&�1�*��� �Q��� �Y�q�!�_�_��� �#�a�&�&�A�+�+� �q�6�Mr c �R � e Zd ZdZdddz z Zd� Zd� Zd� Zd� Zd � Z d � Z d� Zd� Zd S )�_ElementzElement of GF(2^128) field� � � c � � t |� � r || _ dS t |� � dk rt |� � | _ dS t d� � �)z�Initialize the element to a certain value. The value passed as parameter is internally encoded as a 128-bit integer, where each bit represents a polynomial coefficient. The LSB is the constant coefficient. � z8The encoded value must be an integer or a 16 byte stringN)r �_value�lenr � ValueError)�self� encoded_values r �__init__z_Element.__init__S sU � � ��'�'� Y�'�D�K�K�K� �� � �2� %� %�'� �6�6�D�K�K�K��W�X�X�Xr c �"