403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/Cryptodome/Protocol/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/Cryptodome/Protocol/__pycache__/SecretSharing.cpython-311.pyc
�

8�tcZ"��~�ddlmZddlmZddlmZmZddlmZ	d�Z
d�ZGd�de��Z
Gd	�d
e��ZdS)�)�
is_native_int)�number)�
long_to_bytes�
bytes_to_long)�get_random_bytesc�N�||kr||}}d}|r|dzr||z}|dz}|dz}|�|S)z!Multiply two polynomials in GF(2)r��)�f1�f2�zs   �C/usr/lib/python3/dist-packages/Cryptodome/Protocol/SecretSharing.py�	_mult_gf2r(s[��
�B�w�w��R�B��	�A�
��
��6�	�
��G�A�
�q���
�q���	
��

�H�c���||krd|fStj}d}|}||��}||��|kr8d||��|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)
    rr	)r�sizer)�a�b�deg�q�r�d�ss       r�_div_gf2r7s���	
�A����!�t��
�+�C�	�A�	�A���A���A�

�#�a�&�&�A�+�+�
�#�#�a�&�&�1�*���	�Q���	�Y�q�!�_�_����#�a�&�&�A�+�+�
�q�6�Mrc�R�eZdZdZdddzzZd�Zd�Zd�Zd�Zd	�Z	d
�Z
d�Zd�Zd
S)�_ElementzElement of GF(2^128) field���c��t|��r	||_dSt|��dkrt|��|_dSt	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__SsU����'�'�	Y�'�D�K�K�K�
��
�
�2�
%�
%�'�
�6�6�D�K�K�K��W�X�X�Xrc�"�|j|jkS�N�r")r%�others  r�__eq__z_Element.__eq__bs���{�e�l�*�*rc��|jS)z7Return the field element, encoded as a 128-bit integer.r*�r%s r�__int__z_Element.__int__es
���{�rc�,�t|jd��S)z6Return the field element, encoded as a 16 byte string.r!)rr"r.s r�encodez_Element.encodeis���T�[�"�-�-�-rc���|j}|j}||kr||}}|j||fvrtd��Sddz}|d}}|r�tt	|dz��dd�dzd���}|||zz||z
dz
|zz}|dz}tt	|dz	dz��dd�dzd���}|||jzz||z
dz
|zz}|dz}|��t|��S)Nrrrr	)�base)r"�irr_polyr�int�bin)	r%�factorrr�mask1�vr
�mask2�mask3s	         r�__mul__z_Element.__mul__ms"��
�[��
�]����7�7����B��=�R��H�$�$��A�;�;���S����1�1���	���B��F���A�B�B��#�-�A�6�6�6�E��!�a�%��e�e�m�a�&7�1�%<�=�A�
�!�G�A���Q�#�X��N�+�+�A�B�B�/�#�5�A�>�>�>�E��!�d�m�+�,�%�%�-�!�2C�q�1H�I�A��1�H�B��	���{�{�rc�:�t|j|jz��Sr))rr")r%�terms  r�__add__z_Element.__add__�s�����d�k�1�2�2�2rc��|jdkrtd���|j|j}}d\}}|dkrFt||��d}||t	||��z}}||t	||��z}}|dk�Ft|��S)z0Return the inverse of this element in GF(2^128).rzInversion of zero)r	r)r"r$r4rrr)r%�r0�r1�s0�s1rs      r�inversez_Element.inverse�s����;�!����0�1�1�1���d�m�B�����B��1�f�f���R� � ��#�A���i��2�.�.�.��B���i��2�.�.�.��B��1�f�f���|�|�rc�b�t|j��}t|dz
��D]}||z}�|S)Nr	)rr"�range)r%�exponent�result�_s    r�__pow__z_Element.__pow__�s<���$�+�&�&���x�!�|�$�$�	#�	#�A��d�]�F�F��
rN)
�__name__�
__module__�__qualname__�__doc__r4r'r,r/r1r<r?rErKr
rrrrMs�������$�$���c��)�H�
Y�
Y�
Y�+�+�+����.�.�.����23�3�3����"����rrc�B�eZdZdZedd���Zedd���ZdS)�Shamirz�Shamir's secret sharing scheme.

    A secret is split into ``n`` shares, and it is sufficient to collect
    ``k`` of them to reconstruct the secret.
    Fc������d�t|dz
��D�����t|����d�����fd�td|dz��D��S)a�Split a secret into ``n`` shares.

        The secret can be reconstructed later using just ``k`` shares
        out of the original ``n``.
        Each share must be kept confidential to the person it was
        assigned to.

        Each share is associated to an index (starting from 1).

        Args:
          k (integer):
            The sufficient number of shares to reconstruct the secret (``k < n``).
          n (integer):
            The number of shares that this method will create.
          secret (byte string):
            A byte string of 16 bytes (e.g. the AES 128 key).
          ssss (bool):
            If ``True``, the shares can be used with the ``ssss`` utility.
            Default: ``False``.

        Return (tuples):
            ``n`` tuples. A tuple is meant for each participant and it contains two items:

            1. the unique index (an integer)
            2. the share (a byte string, 16 bytes)
        c�F�g|]}ttd������S)r!)r�rng)�.0�is  r�
<listcomp>z Shamir.split.<locals>.<listcomp>�s&��:�:�:��(�3�r�7�7�#�#�:�:�:rr	c���t|��}td��}|D]
}||z|z}�|r"|t|��t|��zz
}|���S)Nr)rr#r1)�user�coeffs�ssss�idx�share�coeffs      r�
make_sharez Shamir.split.<locals>.make_share�sh���4�.�.�C��Q�K�K�E��
,�
,���e��e�+����
7���$���3�v�;�;�6�6���<�<�>�>�!rc�.��g|]}|�|����f��Sr
r
)rUrVrZr_r[s  ���rrWz Shamir.split.<locals>.<listcomp>�s,���J�J�J�Q��J�J�q�&�$�/�/�0�J�J�Jr)rG�appendr)�k�n�secretr[rZr_s   `@@r�splitzShamir.split�s}�����J;�:�U�1�q�5�\�\�:�:�:���
�
�h�v�&�&�'�'�'�
	"�	"�	"�K�J�J�J�J�J�%��1�q�5�/�/�J�J�J�Jrc�v��t|��}g}|D]w}t|d���t|d��}t�fd�|D����rtd���|r|�|zz
}|��|f���xtd��}t|��D]{}||\}}	td��}
td��}t|��D]#}||d}
||kr
|
|
z}
|||
zz}�$||	|
z|���zz
}�||���S)a�Recombine a secret, if enough shares are presented.

        Args:
          shares (tuples):
            The *k* tuples, each containin the index (an integer) and
            the share (a byte string, 16 bytes long) that were assigned to
            a participant.
          ssss (bool):
            If ``True``, the shares were produced by the ``ssss`` utility.
            Default: ``False``.

        Return:
            The original secret, as a byte string (16 bytes long).
        rr	c3�0�K�|]}|d�kV��dS)rNr
)rU�yr\s  �r�	<genexpr>z!Shamir.combine.<locals>.<genexpr>s+�����2�2�1�1�Q�4�3�;�2�2�2�2�2�2rzDuplicate share)r#r�anyr$rarGrEr1)�sharesr[rb�	gf_shares�x�valuerI�j�x_j�y_j�	numerator�denominator�m�x_mr\s              @r�combinezShamir.combine�s]���>
��K�K���	��	+�	+�A��1�Q�4�.�.�C��Q�q�T�N�N�E��2�2�2�2�	�2�2�2�2�2�
4� �!2�3�3�3��
"�����!�����c�5�\�*�*�*�*��!�����q���	>�	>�A� ��|�H�C�� ����I�"�1�+�+�K��1�X�X�
-�
-����l�1�o����6�6���$�I��3��9�,�K���c�I�o��(;�(;�(=�(=�=�=�F�F��}�}���rN)F)rLrMrNrO�staticmethodrervr
rrrQrQ�sc���������3K�3K�3K��\�3K�j�7�7�7��\�7�7�7rrQN)�Cryptodome.Util.py3compatr�Cryptodome.Utilr�Cryptodome.Util.numberrr�Cryptodome.RandomrrTrr�objectrrQr
rr�<module>r}s���D4�3�3�3�3�3�"�"�"�"�"�"�?�?�?�?�?�?�?�?�5�5�5�5�5�5�
�
�
����,Q�Q�Q�Q�Q�v�Q�Q�Q�hu�u�u�u�u�V�u�u�u�u�ur

Youez - 2016 - github.com/yon3zu
LinuXploit