+
    ^eòj¢#  ã                   ór   € ^ RI Ht ^ RIHt ^ RIHtHt ^ RIHt	 R t
R t ! R R]4      t ! R	 R
]4      tR# )é    )Úis_native_int)Únumber)Úlong_to_bytesÚbytes_to_long)Úget_random_bytesc                ó€   € W8”  d   Yr^ pV'       d,   V^,          '       d	   W ,          pV ^,          p V^,          pK3  V# )z!Multiply two polynomials in GF(2)© )Úf1Úf2Úzs   && Ú”/opt/data/installs/351f81cc06284494/environments/aa258815729c481f8402f54f4c368f83/venv/lib/python3.14/site-packages/Crypto/Protocol/SecretSharing.pyÚ	_mult_gf2r   (   s=   € ð 
„wØˆBØ	€Aß
Ø��6Œ6Ø�GˆAØ
ˆq�ˆØ
ˆq�ŠØ€Hó    c                óÒ   € W8  d   ^ V 3# \         P                  p^ pT pV! V4      pV! V4      V8¼  d3   ^V! V4      V,
          ,          pW6,          pV\        W4      ,          pK?  W43# )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   Úsizer   )ÚaÚbÚdegÚqÚrÚdÚss   &&     r   Ú_div_gf2r   7   sg   € ð 	
ŒØ�!ˆtˆä
�+‰+€CØ	€AØ	€AÙˆA‹€AÙ
ˆa‹&�AŒ+Ø‘#�a“&˜1•*ÕˆØ	�ˆØ	ŒY�q‹_ÕŠØˆ6€Mr   c                   ót   a € ] tR t^Mt o Rt^‡^^€,          ,           tR tR tR tR t	R t
R tR tR	 tR
tV tR# )Ú_ElementzElement of GF(2^128) fieldc                óŽ   € \        V4      '       d	   Wn        R# \        V4      ^8X  d   \        V4      V n        R# \	        R4      h)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__Ú_Element.__init__T   s9   € ô ˜×'Ò'Ø'ŽKÜ�Ó 2Ô%Ü'¨Ó6ˆDŽKäÐWÓXÐXr   c                ó4   € V P                   VP                   8H  # ©N©r   )r    Úothers   &&r   Ú__eq__Ú_Element.__eq__c   s   € Ø�{‰{˜eŸl™lÑ*Ð*r   c                ó   € V P                   # )z7Return the field element, encoded as a 128-bit integer.r&   ©r    s   &r   Ú__int__Ú_Element.__int__f   s   € à�{‰{Ðr   c                ó.   € \        V P                  ^4      # )z6Return the field element, encoded as a 16 byte string.)r   r   r+   s   &r   ÚencodeÚ_Element.encodej   s   € ä˜TŸ[™[¨"Ó-Ð-r   c                óX  € V P                   pVP                   pW28”  d   Y2r2V P                  W#39   d   \        ^ 4      # ^^€,          pT^ reV'       dÐ   \        \	        V^,          4      R,          ^€,          ^R7      pWvV,          ,          WG,
          ^,
          V,          ,          pV^,          p\        \	        V^€,	          ^,          4      R,          ^€,          ^R7      pW…V P                  ,          ,          WH,
          ^,
          V,          ,          pV^,          pK×  \        V4      # )r   :é   NN)Úbase)r   Úirr_polyr   ÚintÚbin)	r    Úfactorr
   r   Úmask1Úvr   Úmask2Úmask3s	   &&       r   Ú__mul__Ú_Element.__mul__n   så   € à�[‰[ˆØ�]‰]ˆð Œ7Ø�à�=‰=˜R˜HÔ$Ü˜A“;Ðà�S•ˆØ�1ˆ1ßäœ˜B �F› B�¨#Õ-°AÔ6ˆEØ˜a�%• e¥m°aÕ&7¸1Õ%<Õ=ˆAØ�!�GˆAäœ˜Q #�X¨�NÓ+¨BÕ/°#Õ5¸AÔ>ˆEØ˜dŸm™mÕ+Õ,°%µ-À!Õ2CÀqÕ1HÕIˆAØ�1�HŠBÜ˜‹{Ðr   c                óN   € \        V P                  VP                  ,          4      # r%   )r   r   )r    Úterms   &&r   Ú__add__Ú_Element.__add__‡   s   € Ü˜Ÿ™ d§k¡kÕ1Ó2Ð2r   c                ó  € V P                   ^ 8X  d   \        R4      hV P                   V P                  r!^^ rCV^ 8”  d9   \        W4      ^ ,          pY!\	        WR4      ,          r!YC\	        WT4      ,          rCK?  \        V4      # )z0Return the inverse of this element in GF(2^128).zInversion of zero)r   r   r4   r   r   r   )r    Úr0Úr1Ús0Ús1r   s   &     r   ÚinverseÚ_Element.inverseŠ   sp   € ð �;‰;˜!ÔÜÐ0Ó1Ð1à—‘˜dŸm™mˆBØ�AˆBØ�1ŒfÜ˜Ó  Õ#ˆAØœi¨Ó.Õ.�Øœi¨Ó.Õ.’Ü˜‹|Ðr   c                ór   € \        V P                  4      p\        V^,
          4       F  pW ,          pK  	  V# )é   )r   r   Úrange)r    ÚexponentÚresultÚ_s   &&  r   Ú__pow__Ú_Element.__pow__›   s/   € Ü˜$Ÿ+™+Ó&ˆÜ�x !•|Ö$ˆAØ•]ŠFñ %àˆr   r&   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r4   r"   r(   r,   r/   r<   r@   rG   rO   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r   M   sF   ø‡ € Ù$ð   c¥Õ)€HòYò+òò.òò23ò÷"ð r   r   c                   óL   a € ] tR t^¢t o Rt]RR l4       t]RR l4       tRtV t	R# )Ú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.
c           	     ó  € \        V ^,
          4       Uu. uF  p\        \        ^4      4      NK  	  ppVP                  \        V4      4       R p\        ^V^,           4       Uu. uF  qDV! WEV4      3NK  	  up# u upi u upi )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 number of shares needed to reconstruct the secret.
  n (integer):
    The number of shares to create (at least ``k``).
  secret (byte string):
    A byte string of 16 bytes (e.g. an AES 128 key).
  ssss (bool):
    If ``True``, the shares can be used with the ``ssss`` utility
    (without using the "diffusion layer").
    Default: ``False``.

Return (tuples):
    ``n`` tuples, one per participant.
    A tuple contains two items:

    1. the unique index (an integer)
    2. the share (16 bytes)
c                 óÒ   € \        V 4      p\        ^ 4      pV F  pW4,          V,           pK  	  V'       d#   V\        V 4      \        V4      ,          ,          pVP                  4       # )r   )r   r   r/   )ÚuserÚcoeffsÚssssÚidxÚshareÚcoeffs   &&&   r   Ú
make_shareÚ Shamir.split.<locals>.make_shareÖ   sT   € Ü˜4“.ˆCô ˜Q“KˆEÛ�Ø� eÕ+’ñ  ÷ Øœ $›¬3¨v«;Õ6Õ6�à—<‘<“>Ð!r   )rK   r   ÚrngÚappend)ÚkÚnÚsecretr`   Úir_   rd   s   &&&&   r   ÚsplitÚShamir.split©   sw   € ôN .3°1°qµ5¬\Ó:©\¨”(œ3˜r›7Ö#©\ˆÐ:Ø�‰”h˜vÓ&Ô'ò
	"ô" ;@ÀÀ1ÀqÅ5¼/ÓJ¹/°Q‘J˜q¨$Ó/Ó0¹/ÑJÐJùò/ ;ùò. Ks   •A<Á&Bc                óÆ  a€ \        V 4      p. pV  F�  p\        V^ ,          4      o\        V^,          4      p\        ;QJ d    V3R lV 4       F  '       g   K   RM	  RM! V3R lV 4       4      '       d   \        R4      hV'       d   VSV,          ,          pVP	                  SV34       KŸ  	  \        ^ 4      p\        V4       F‡  pW7,          w  r‰\        ^4      p
\        ^4      p\        V4       F1  pW<,          ^ ,          pWÇ8w  g   K  W­,          p
W¸V,           ,          pK3  	  WiV
,          VP                  4       ,          ,          pK‰  	  VP                  4       # )a  Recombine a secret, if enough shares are presented.

Args:
  shares (tuples):
    The *k* tuples, each containing the index (an integer) and
    the share (a byte string, 16 bytes long) that were assigned to
    a participant.

    .. note::

        Pass exactly as many share as they are required,
        and no more.

  ssss (bool):
    If ``True``, the shares were produced by the ``ssss`` utility
    (without using the "diffusion layer").
    Default: ``False``.

Return:
    The original secret, as a byte string (16 bytes long).
c              3   ó:   <"  € T F  q^ ,          S8H  x € K  	  R# 5i)r   Nr	   )Ú.0Úyra   s   & €r   Ú	<genexpr>Ú!Shamir.combine.<locals>.<genexpr>  s   øé € Ð2©	 1�Q•4˜3–;«	ùs   ƒTFzDuplicate share)r   r   Úanyr   rg   rK   rG   r/   )Úsharesr`   rh   Ú	gf_sharesÚxÚvaluerM   ÚjÚx_jÚy_jÚ	numeratorÚdenominatorÚmÚx_mra   s   &&            @r   ÚcombineÚShamir.combineé   s  ø€ ôL �‹Kˆàˆ	ÛˆAÜ˜1˜Q�4“.ˆCÜ˜Q˜q�T“NˆEß‹sÔ2©	Ó2�s�sŠsÔ2©	Ó2×2Ò2Ü Ð!2Ó3Ð3ßØ˜ �Õ!�Ø×Ñ˜c 5˜\Ö*ñ ô ˜!“ˆÜ�q–ˆAØ •|‰HˆCä  ›ˆIÜ" 1›+ˆKä˜1–X�Ø•l 1•o�Ø–6ØÕ$�IØ¨¥9Õ,’Kñ	 ð
 ˜I•o¨×(;Ñ(;Ó(=Õ=Õ=ŠFñ ð �}‰}‹Ðr   r	   N)F)
rQ   rR   rS   rT   rU   Ústaticmethodrl   r€   rV   rW   rX   s   @r   r[   r[   ¢   s5   ø‡ € ñð ó=Kó ð=Kð~ ó?ó ö?r   r[   N)ÚCrypto.Util.py3compatr   ÚCrypto.Utilr   ÚCrypto.Util.numberr   r   ÚCrypto.Randomr   rf   r   r   Úobjectr   r[   r	   r   r   Ú<module>rˆ      s;   ðõD 0Ý ß ;Ý 1òòô,Rˆvô RôjGˆVö Gr   