ó
    &ÝNjþ:  ã                   óª  • S SK Jr  S SKJrJr  S SKJr  \" \R                  5      r
S rS rS r\
(       a3  \R                  " 5       r\R                  " 5       r\R                   " 5       rS\S\4S jrS\S\4S jrS\S	\S\4S
 jrS\S	\S\4S jrS\S\4S jrS\S\4S jrS\S\4S jrS\S	\S\4S jrS\S	\S\4S jrS\S	\S\4S jrS\S\4S jrg)é    )Ú
exceptions)ÚffiÚlib)ÚensureÚpÚreturnc                 óò   • [        [        S[        R                  S9  [        [	        U [
        5      =(       a    [        U 5      [        :H  S[        R                  S9  [        R                  " U 5      nUS:H  $ )a«  
Check if ``p`` represents a point on the edwards25519 curve, in canonical
form, on the main subgroup, and that the point doesn't have a small order.

:param p: a :py:data:`.crypto_core_ed25519_BYTES` long bytes sequence
          representing a point on the edwards25519 curve
:type p: bytes
:return: point validity
:rtype: bool
:raises nacl.exceptions.UnavailableError: If called when using a
    minimal build of libsodium.
úNot available in minimal build©Úraisingz=Point must be a crypto_core_ed25519_BYTES long bytes sequenceé   )r   Úhas_crypto_core_ed25519ÚexcÚUnavailableErrorÚ
isinstanceÚbytesÚlenÚcrypto_core_ed25519_BYTESÚ	TypeErrorr   Ú"crypto_core_ed25519_is_valid_point)r   Úrcs     ÚV/home/mande/repo/quber/.venv/lib/python3.13/site-packages/nacl/bindings/crypto_core.pyr   r   #   sc   € ô ÜØ(Ü×$Ñ$òô Ü�1”eÓ×D¤ Q£Ô+DÑ!DØGÜ—‘òô 
×	/Ò	/°Ó	2€BØ�‰7€Nó    Úrc                 ó°  • [        [        S[        R                  S9  [        [	        U [
        5      =(       a    [        U 5      [        :H  SR                  S5      [        R                  S9  [        R                  " S[        5      n[        R                  " X5      n[        US:H  S[        R                  S9  [        R                  " U[        5      SS $ )	a  
Maps a 32 bytes vector ``r`` to a point. The point is guaranteed to be on the main subgroup.
This function directly exposes the Elligator 2 map, uses the high bit to set
the sign of the X coordinate, and the resulting point is multiplied by the cofactor.

:param r: a :py:data:`.crypto_core_ed25519_BYTES` long bytes
          sequence representing arbitrary data
:type r: bytes
:return: a point on the edwards25519 curve main order subgroup, represented as a
         :py:data:`.crypto_core_ed25519_BYTES` long bytes sequence
:rtype: bytes
:raises nacl.exceptions.UnavailableError: If called when using a
    minimal build of libsodium.
r
   r   z*Integer r must be a {} long bytes sequencer   úunsigned char[]r   úUnexpected library errorN)r   r   r   r   r   r   r   r   Úformatr   r   Únewr   Ú crypto_core_ed25519_from_uniformÚRuntimeErrorÚbuffer)r   r   r   s      r   r    r    @   sª   € ô ÜØ(Ü×$Ñ$òô Ü�1”eÓ×D¤ Q£Ô+DÑ!DØ4×;Ñ;Ø'ó	
ô —‘òô 	�ŠÐ!Ô#<Ó=€Aä	×	-Ò	-¨aÓ	3€BÜ
ˆ2�‰7Ð.¼×8HÑ8HÒIä�:Š:�aÔ2Ó3±AÐ6Ð6r   Úqc                 ó  • [        [        S[        R                  S9  [        [	        U [
        5      =(       aB    [	        U[
        5      =(       a+    [        U 5      [        :H  =(       a    [        U5      [        :H  SR                  S5      [        R                  S9  [        R                  " S[        5      n[        R                  " X U5      n[        US:H  S[        R                  S9  [        R                  " U[        5      SS $ )	a6  
Add two points on the edwards25519 curve.

:param p: a :py:data:`.crypto_core_ed25519_BYTES` long bytes sequence
          representing a point on the edwards25519 curve
:type p: bytes
:param q: a :py:data:`.crypto_core_ed25519_BYTES` long bytes sequence
          representing a point on the edwards25519 curve
:type q: bytes
:return: a point on the edwards25519 curve represented as
         a :py:data:`.crypto_core_ed25519_BYTES` long bytes sequence
:rtype: bytes
:raises nacl.exceptions.UnavailableError: If called when using a
    minimal build of libsodium.
r
   r   ú+Each point must be a {} long bytes sequencer   r   r   r   N)r   r   r   r   r   r   r   r   r   r   r   r   r   Úcrypto_core_ed25519_addr!   r"   ©r   r#   r   r   s       r   r&   r&   e   óÒ   € ô  ÜØ(Ü×$Ñ$òô Ü�1”eÓ÷ 	0Ü�qœ%Ó ÷	0ä�‹FÔ/Ñ/÷	0ô �‹FÔ/Ñ/Ø5×<Ñ<Ø'ó	
ô —‘ò	ô 	�ŠÐ!Ô#<Ó=€Aä	×	$Ò	$ Q¨1Ó	-€BÜ
ˆ2�‰7Ð.¼×8HÑ8HÒIä�:Š:�aÔ2Ó3±AÐ6Ð6r   c                 ó  • [        [        S[        R                  S9  [        [	        U [
        5      =(       aB    [	        U[
        5      =(       a+    [        U 5      [        :H  =(       a    [        U5      [        :H  SR                  S5      [        R                  S9  [        R                  " S[        5      n[        R                  " X U5      n[        US:H  S[        R                  S9  [        R                  " U[        5      SS $ )	aE  
Subtract a point from another on the edwards25519 curve.

:param p: a :py:data:`.crypto_core_ed25519_BYTES` long bytes sequence
          representing a point on the edwards25519 curve
:type p: bytes
:param q: a :py:data:`.crypto_core_ed25519_BYTES` long bytes sequence
          representing a point on the edwards25519 curve
:type q: bytes
:return: a point on the edwards25519 curve represented as
         a :py:data:`.crypto_core_ed25519_BYTES` long bytes sequence
:rtype: bytes
:raises nacl.exceptions.UnavailableError: If called when using a
    minimal build of libsodium.
r
   r   r%   r   r   r   r   N)r   r   r   r   r   r   r   r   r   r   r   r   r   Úcrypto_core_ed25519_subr!   r"   r'   s       r   r*   r*   Ž   r(   r   Úsc                 ó°  • [        [        S[        R                  S9  [        [	        U [
        5      =(       a    [        U 5      [        :H  SR                  S5      [        R                  S9  [        R                  " S[        5      n[        R                  " X5      n[        US:H  S[        R                  S9  [        R                  " U[        5      SS $ )	a@  
Return the multiplicative inverse of integer ``s`` modulo ``L``,
i.e an integer ``i`` such that ``s * i = 1 (mod L)``, where ``L``
is the order of the main subgroup.

Raises a ``exc.RuntimeError`` if ``s`` is the integer zero.

:param s: a :py:data:`.crypto_core_ed25519_SCALARBYTES`
          long bytes sequence representing an integer
:type s: bytes
:return: an integer represented as a
          :py:data:`.crypto_core_ed25519_SCALARBYTES` long bytes sequence
:rtype: bytes
:raises nacl.exceptions.UnavailableError: If called when using a
    minimal build of libsodium.
r
   r   ú*Integer s must be a {} long bytes sequenceÚcrypto_core_ed25519_SCALARBYTESr   r   r   N)r   r   r   r   r   r   r   r.   r   r   r   r   r   Ú!crypto_core_ed25519_scalar_invertr!   r"   )r+   r   r   s      r   r/   r/   ·   sª   € ô" ÜØ(Ü×$Ñ$òô Ü�1”eÓ×J¤ Q£Ô+JÑ!JØ4×;Ñ;Ø-ó	
ô —‘òô 	�ŠÐ!Ô#BÓC€Aä	×	.Ò	.¨qÓ	4€BÜ
ˆ2�‰7Ð.¼×8HÑ8HÒIä�:Š:�aÔ8Ó9¹!Ð<Ð<r   c                 óx  • [        [        S[        R                  S9  [        [	        U [
        5      =(       a    [        U 5      [        :H  SR                  S5      [        R                  S9  [        R                  " S[        5      n[        R                  " X5        [        R                  " U[        5      SS $ )aÆ  
Return the integer ``n`` such that ``s + n = 0 (mod L)``, where ``L``
is the order of the main subgroup.

:param s: a :py:data:`.crypto_core_ed25519_SCALARBYTES`
          long bytes sequence representing an integer
:type s: bytes
:return: an integer represented as a
          :py:data:`.crypto_core_ed25519_SCALARBYTES` long bytes sequence
:rtype: bytes
:raises nacl.exceptions.UnavailableError: If called when using a
    minimal build of libsodium.
r
   r   r-   r.   r   N)r   r   r   r   r   r   r   r.   r   r   r   r   r   Ú!crypto_core_ed25519_scalar_negater"   ©r+   r   s     r   r1   r1   Þ   s‘   € ô ÜØ(Ü×$Ñ$òô Ü�1”eÓ×J¤ Q£Ô+JÑ!JØ4×;Ñ;Ø-ó	
ô —‘òô 	�ŠÐ!Ô#BÓC€Aä×)Ò)¨!Ô/ä�:Š:�aÔ8Ó9¹!Ð<Ð<r   c                 óx  • [        [        S[        R                  S9  [        [	        U [
        5      =(       a    [        U 5      [        :H  SR                  S5      [        R                  S9  [        R                  " S[        5      n[        R                  " X5        [        R                  " U[        5      SS $ )aø  
Return the complement of integer ``s`` modulo ``L``, i.e. an integer
``c`` such that ``s + c = 1 (mod L)``, where ``L`` is the order of
the main subgroup.

:param s: a :py:data:`.crypto_core_ed25519_SCALARBYTES`
          long bytes sequence representing an integer
:type s: bytes
:return: an integer represented as a
          :py:data:`.crypto_core_ed25519_SCALARBYTES` long bytes sequence
:rtype: bytes
:raises nacl.exceptions.UnavailableError: If called when using a
    minimal build of libsodium.
r
   r   r-   r.   r   N)r   r   r   r   r   r   r   r.   r   r   r   r   r   Ú%crypto_core_ed25519_scalar_complementr"   r2   s     r   r4   r4     s‘   € ô ÜØ(Ü×$Ñ$òô Ü�1”eÓ×J¤ Q£Ô+JÑ!JØ4×;Ñ;Ø-ó	
ô —‘òô 	�ŠÐ!Ô#BÓC€Aä×-Ò-¨aÔ3ä�:Š:�aÔ8Ó9¹!Ð<Ð<r   c                 óÚ  • [        [        S[        R                  S9  [        [	        U [
        5      =(       aB    [	        U[
        5      =(       a+    [        U 5      [        :H  =(       a    [        U5      [        :H  SR                  S5      [        R                  S9  [        R                  " S[        5      n[        R                  " X U5        [        R                  " U[        5      SS $ )a4  
Add integers ``p`` and ``q`` modulo ``L``, where ``L`` is the order of
the main subgroup.

:param p: a :py:data:`.crypto_core_ed25519_SCALARBYTES`
          long bytes sequence representing an integer
:type p: bytes
:param q: a :py:data:`.crypto_core_ed25519_SCALARBYTES`
          long bytes sequence representing an integer
:type q: bytes
:return: an integer represented as a
          :py:data:`.crypto_core_ed25519_SCALARBYTES` long bytes sequence
:rtype: bytes
:raises nacl.exceptions.UnavailableError: If called when using a
    minimal build of libsodium.
r
   r   ú-Each integer must be a {} long bytes sequencer.   r   N)r   r   r   r   r   r   r   r.   r   r   r   r   r   Úcrypto_core_ed25519_scalar_addr"   ©r   r#   r   s      r   r7   r7   %  ó¹   € ô" ÜØ(Ü×$Ñ$òô Ü�1”eÓ÷ 	6Ü�qœ%Ó ÷	6ä�‹FÔ5Ñ5÷	6ô �‹FÔ5Ñ5Ø7×>Ñ>Ø-ó	
ô —‘ò	ô 	�ŠÐ!Ô#BÓC€Aä×&Ò& q¨QÔ/ä�:Š:�aÔ8Ó9¹!Ð<Ð<r   c                 óÚ  • [        [        S[        R                  S9  [        [	        U [
        5      =(       aB    [	        U[
        5      =(       a+    [        U 5      [        :H  =(       a    [        U5      [        :H  SR                  S5      [        R                  S9  [        R                  " S[        5      n[        R                  " X U5        [        R                  " U[        5      SS $ )a9  
Subtract integers ``p`` and ``q`` modulo ``L``, where ``L`` is the
order of the main subgroup.

:param p: a :py:data:`.crypto_core_ed25519_SCALARBYTES`
          long bytes sequence representing an integer
:type p: bytes
:param q: a :py:data:`.crypto_core_ed25519_SCALARBYTES`
          long bytes sequence representing an integer
:type q: bytes
:return: an integer represented as a
          :py:data:`.crypto_core_ed25519_SCALARBYTES` long bytes sequence
:rtype: bytes
:raises nacl.exceptions.UnavailableError: If called when using a
    minimal build of libsodium.
r
   r   r6   r.   r   N)r   r   r   r   r   r   r   r.   r   r   r   r   r   Úcrypto_core_ed25519_scalar_subr"   r8   s      r   r;   r;   N  r9   r   c                 óÚ  • [        [        S[        R                  S9  [        [	        U [
        5      =(       aB    [	        U[
        5      =(       a+    [        U 5      [        :H  =(       a    [        U5      [        :H  SR                  S5      [        R                  S9  [        R                  " S[        5      n[        R                  " X U5        [        R                  " U[        5      SS $ )a9  
Multiply integers ``p`` and ``q`` modulo ``L``, where ``L`` is the
order of the main subgroup.

:param p: a :py:data:`.crypto_core_ed25519_SCALARBYTES`
          long bytes sequence representing an integer
:type p: bytes
:param q: a :py:data:`.crypto_core_ed25519_SCALARBYTES`
          long bytes sequence representing an integer
:type q: bytes
:return: an integer represented as a
          :py:data:`.crypto_core_ed25519_SCALARBYTES` long bytes sequence
:rtype: bytes
:raises nacl.exceptions.UnavailableError: If called when using a
    minimal build of libsodium.
r
   r   r6   r.   r   N)r   r   r   r   r   r   r   r.   r   r   r   r   r   Úcrypto_core_ed25519_scalar_mulr"   r8   s      r   r=   r=   w  r9   r   c                 óx  • [        [        S[        R                  S9  [        [	        U [
        5      =(       a    [        U 5      [        :H  SR                  S5      [        R                  S9  [        R                  " S[        5      n[        R                  " X5        [        R                  " U[        5      SS $ )aÂ  
Reduce integer ``s`` to ``s`` modulo ``L``, where ``L`` is the order
of the main subgroup.

:param s: a :py:data:`.crypto_core_ed25519_NONREDUCEDSCALARBYTES`
          long bytes sequence representing an integer
:type s: bytes
:return: an integer represented as a
          :py:data:`.crypto_core_ed25519_SCALARBYTES` long bytes sequence
:rtype: bytes
:raises nacl.exceptions.UnavailableError: If called when using a
    minimal build of libsodium.
r
   r   r-   Ú)crypto_core_ed25519_NONREDUCEDSCALARBYTESr   N)r   r   r   r   r   r   r   r?   r   r   r   r   r.   r   Ú!crypto_core_ed25519_scalar_reducer"   r2   s     r   r@   r@      s•   € ô ÜØ(Ü×$Ñ$òô Ü�1”eÓ÷ 	@Ü�‹FÔ?Ñ?Ø4×;Ñ;Ø7ó	
ô —‘òô 	�ŠÐ!Ô#BÓC€Aä×)Ò)¨!Ô/ä�:Š:�aÔ8Ó9¹!Ð<Ð<r   N)Únaclr   r   Únacl._sodiumr   r   Únacl.exceptionsr   ÚboolÚPYNACL_HAS_CRYPTO_CORE_ED25519r   r   r.   r?   Úcrypto_core_ed25519_bytesÚcrypto_core_ed25519_scalarbytesÚ)crypto_core_ed25519_nonreducedscalarbytesr   r   r    r&   r*   r/   r1   r4   r7   r;   r=   r@   © r   r   Ú<module>rJ      sd  ðõ  #ß !Ý "ñ ˜s×AÑAÓBÐ àÐ Ø"#Ð Ø,-Ð )æØ #× =Ò =Ó ?ÐØ&)×&IÒ&IÓ&KÐ#à×5Ò5Ó7ð .ð
¨%ð °Dô ð:"7¨ð "7°%ô "7ðJ&7˜uð &7¨ð &7°5ô &7ðR&7˜uð &7¨ð &7°5ô &7ðR$=¨ð $=°5ô $=ðN =¨ð  =°5ô  =ðF!=¨Uð !=°uô !=ðH&= eð &=°ð &=¸%ô &=ðR&= eð &=°ð &=¸%ô &=ðR&= eð &=°ð &=¸%ô &=ðR!=¨ð !=°5õ !=r   