§
    ­eîií<  ã            
       ó¤  — U d dl mZ d dlmZ d dlmZmZ d dlm	Z	 	  ej
        ¦   «         Zeed<    ej        ¦   «         Zeed<    ej        ¦   «         Zeed<    ej        ¦   «         Zeed<    ej        ¦   «         Zeed	<   eez   Z ej        ¦   «         Zeed
<    ej        ¦   «         Zeed<    ej        ¦   «         Zeed<    ej        ¦   «         Zeed<    ej        ¦   «         Z eed<   e ez   Z! ej"        ¦   «         Z#eed<    ej$        ¦   «         Z%eed<    ej&        ¦   «         Z'eed<    ej(        ¦   «         Z)eed<    ej*        ¦   «         Z+eed<   e+e)z   Z,de-dee-         de-de-de-f
d„Z.de-dee-         de-de-de-f
d„Z/de-dee-         de-de-de-f
d„Z0de-dee-         de-de-de-f
d„Z1de-dee-         de-de-de-f
d„Z2de-dee-         de-de-de-f
d„Z3d S )!é    )ÚOptional)Ú
exceptions)ÚffiÚlib)ÚensureÚ*crypto_aead_chacha20poly1305_ietf_KEYBYTESÚ+crypto_aead_chacha20poly1305_ietf_NSECBYTESÚ+crypto_aead_chacha20poly1305_ietf_NPUBBYTESÚ(crypto_aead_chacha20poly1305_ietf_ABYTESÚ2crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAXÚ%crypto_aead_chacha20poly1305_KEYBYTESÚ&crypto_aead_chacha20poly1305_NSECBYTESÚ&crypto_aead_chacha20poly1305_NPUBBYTESÚ#crypto_aead_chacha20poly1305_ABYTESÚ-crypto_aead_chacha20poly1305_MESSAGEBYTES_MAXÚ+crypto_aead_xchacha20poly1305_ietf_KEYBYTESÚ,crypto_aead_xchacha20poly1305_ietf_NSECBYTESÚ,crypto_aead_xchacha20poly1305_ietf_NPUBBYTESÚ)crypto_aead_xchacha20poly1305_ietf_ABYTESÚ3crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAXÚmessageÚaadÚnonceÚkeyÚreturnc                 óV  — t          t          | t          ¦  «        dt          j        ¬¦  «         t          | ¦  «        }t          |t          k    d                     t          ¦  «        t          j        ¬¦  «         t          t          |t          ¦  «        p|du dt          j        ¬¦  «         t          t          |t          ¦  «        ot          |¦  «        t          k    d                     t          ¦  «        t          j        ¬¦  «         t          t          |t          ¦  «        ot          |¦  «        t          k    d                     t          ¦  «        t          j        ¬¦  «         |r|}t          |¦  «        }nt          j        }d}|t          z   }t          j        d	¦  «        }t          j        d
|¦  «        }	t          j        |	|| |||t          j        ||¦	  «	        }
t          |
dk    dt          j        ¬¦  «         t          j        |	|d         ¦  «        dd…         S )aZ  
    Encrypt the given ``message`` using the IETF ratified chacha20poly1305
    construction described in RFC7539.

    :param message:
    :type message: bytes
    :param aad:
    :type aad: Optional[bytes]
    :param nonce:
    :type nonce: bytes
    :param key:
    :type key: bytes
    :return: authenticated ciphertext
    :rtype: bytes
    ú Input message type must be bytes©Úraisingú%Message must be at most {} bytes longNú%Additional data must be bytes or Noneú,Nonce must be a {} bytes long bytes sequenceú*Key must be a {} bytes long bytes sequencer   úunsigned long long *úunsigned char[]úEncryption failed.)r   Ú
isinstanceÚbytesÚexcÚ	TypeErrorÚlenr   ÚformatÚ
ValueErrorr
   r   r   ÚNULLr   Únewr   Ú)crypto_aead_chacha20poly1305_ietf_encryptÚCryptoErrorÚbuffer©r   r   r   r   ÚmlenÚ_aadÚaalenÚmxoutÚclenÚ
ciphertextÚress              ú]/home/div/.hermes/hermes-agent/venv/lib/python3.11/site-packages/nacl/bindings/crypto_aead.pyr0   r0   W   s  € õ$ Ý�7�EÑ"Ô"Ø*Ý”ðñ ô ð õ ˆw‰<Œ<€Då
ØÕBÒBØ/×6Ò6Ý>ñ	
ô 	
õ ”ðñ ô ð õ Ý�3�ÑÔÐ/ 3¨$ ;Ø/Ý”ðñ ô ð õ Ý�5�%Ñ Ô ð 	FÝ�‰JŒJÕEÒEØ6×=Ò=Ý7ñ	
ô 	
õ ”ðñ ô ð õ Ý�3�ÑÔð 	CÝ�‰HŒHÕBÒBØ4×;Ò;Ý6ñ	
ô 	
õ ”ðñ ô ð ð ð ØˆÝ�C‘”ˆˆåŒxˆØˆàÕ;Ñ;€EåŒ7Ð)Ñ*Ô*€Då”Ð*¨EÑ2Ô2€Jå
Ô
7Ø�D˜' 4¨¨uµc´hÀÀsñô €Cõ ˆ3�!Š8Ð)µ3´?ÐCÑCÔCÐCÝŒ:�j $ q¤'Ñ*Ô*¨1¨1¨1Ô-Ð-ó    r9   c                 óV  — t          t          | t          ¦  «        dt          j        ¬¦  «         t          | ¦  «        }t          |t          k    d                     t          ¦  «        t          j        ¬¦  «         t          t          |t          ¦  «        p|du dt          j        ¬¦  «         t          t          |t          ¦  «        ot          |¦  «        t          k    d                     t          ¦  «        t          j        ¬¦  «         t          t          |t          ¦  «        ot          |¦  «        t          k    d                     t          ¦  «        t          j        ¬¦  «         |t          z
  }t          j        d¦  «        }t          j        d	|¦  «        }|r|}t          |¦  «        }	nt          j        }d
}	t          j        ||t          j        | |||	||¦	  «	        }
t          |
d
k    dt          j        ¬¦  «         t          j        ||d
         ¦  «        dd…         S )aR  
    Decrypt the given ``ciphertext`` using the IETF ratified chacha20poly1305
    construction described in RFC7539.

    :param ciphertext:
    :type ciphertext: bytes
    :param aad:
    :type aad: Optional[bytes]
    :param nonce:
    :type nonce: bytes
    :param key:
    :type key: bytes
    :return: message
    :rtype: bytes
    ú#Input ciphertext type must be bytesr   ú(Ciphertext must be at most {} bytes longNr!   r"   r#   r$   r%   r   úDecryption failed.)r   r'   r(   r)   r*   r+   Ú*_aead_chacha20poly1305_ietf_CRYPTBYTES_MAXr,   r-   r
   r   r   r   r/   r.   r   Ú)crypto_aead_chacha20poly1305_ietf_decryptr1   r2   ©r9   r   r   r   r8   r7   r4   r   r5   r6   r:   s              r;   rB   rB   ¦   s  € õ$ Ý�:�uÑ%Ô%Ø-Ý”ðñ ô ð õ ˆz‰?Œ?€Då
ØÕ:Ò:Ø2×9Ò9Ý6ñ	
ô 	
õ ”ðñ ô ð õ Ý�3�ÑÔÐ/ 3¨$ ;Ø/Ý”ðñ ô ð õ Ý�5�%Ñ Ô ð 	FÝ�‰JŒJÕEÒEØ6×=Ò=Ý7ñ	
ô 	
õ ”ðñ ô ð õ Ý�3�ÑÔð 	CÝ�‰HŒHÕBÒBØ4×;Ò;Ý6ñ	
ô 	
õ ”ðñ ô ð ð Õ;Ñ;€EåŒ7Ð)Ñ*Ô*€DÝŒgÐ'¨Ñ/Ô/€Gà
ð ØˆÝ�C‘”ˆˆåŒxˆØˆå
Ô
7Ø�•s”x ¨T°4¸ÀÀsñô €Cõ ˆ3�!Š8Ð)µ3´?ÐCÑCÔCÐCåŒ:�g˜t AœwÑ'Ô'¨¨¨Ô*Ð*r<   c                 ót  — t          t          | t          ¦  «        dt          j        ¬¦  «         t          | ¦  «        }t          |t          k    d                     t          ¦  «        t          j        ¬¦  «         t          t          |t          ¦  «        p|du dt          j        ¬¦  «         t          t          |t          ¦  «        ot          |¦  «        t          k    d                     t          ¦  «        t          j        ¬¦  «         t          t          |t          ¦  «        ot          |¦  «        t          k    d                     t          ¦  «        t          j        ¬¦  «         |r|}t          |¦  «        }nt          j        }d}t          | ¦  «        }|t          z   }t          j        d	¦  «        }t          j        d
|¦  «        }	t          j        |	|| |||t          j        ||¦	  «	        }
t          |
dk    dt          j        ¬¦  «         t          j        |	|d         ¦  «        dd…         S )a[  
    Encrypt the given ``message`` using the "legacy" construction
    described in draft-agl-tls-chacha20poly1305.

    :param message:
    :type message: bytes
    :param aad:
    :type aad: Optional[bytes]
    :param nonce:
    :type nonce: bytes
    :param key:
    :type key: bytes
    :return: authenticated ciphertext
    :rtype: bytes
    r   r   r    Nr!   r"   r#   r   r$   r%   r&   )r   r'   r(   r)   r*   r+   r   r,   r-   r   r   r   r.   r   r/   r   Ú$crypto_aead_chacha20poly1305_encryptr1   r2   r3   s              r;   rE   rE   õ   s$  € õ$ Ý�7�EÑ"Ô"Ø*Ý”ðñ ô ð õ ˆw‰<Œ<€Då
ØÕ=Ò=Ø/×6Ò6Ý9ñ	
ô 	
õ ”ðñ ô ð õ Ý�3�ÑÔÐ/ 3¨$ ;Ø/Ý”ðñ ô ð õ Ý�5�%Ñ Ô ð 	AÝ�‰JŒJÕ@Ò@Ø6×=Ò=Ý2ñ	
ô 	
õ ”ðñ ô ð õ Ý�3�ÑÔð 	>Ý�‰HŒHÕ=Ò=Ø4×;Ò;Ý1ñ	
ô 	
õ ”ðñ ô ð ð ð ØˆÝ�C‘”ˆˆåŒxˆØˆåˆw‰<Œ<€DØÕ;Ñ;€EåŒ7Ð)Ñ*Ô*€Då”Ð*¨EÑ2Ô2€Jå
Ô
2Ø�D˜' 4¨¨uµc´hÀÀsñô €Cõ ˆ3�!Š8Ð)µ3´?ÐCÑCÔCÐCÝŒ:�j $ q¤'Ñ*Ô*¨1¨1¨1Ô-Ð-r<   c                 óV  — t          t          | t          ¦  «        dt          j        ¬¦  «         t          | ¦  «        }t          |t          k    d                     t          ¦  «        t          j        ¬¦  «         t          t          |t          ¦  «        p|du dt          j        ¬¦  «         t          t          |t          ¦  «        ot          |¦  «        t          k    d                     t          ¦  «        t          j        ¬¦  «         t          t          |t          ¦  «        ot          |¦  «        t          k    d                     t          ¦  «        t          j        ¬¦  «         |t          z
  }t          j        d¦  «        }t          j        d	|¦  «        }|r|}t          |¦  «        }	nt          j        }d
}	t          j        ||t          j        | |||	||¦	  «	        }
t          |
d
k    dt          j        ¬¦  «         t          j        ||d
         ¦  «        dd…         S )al  
    Decrypt the given ``ciphertext`` using the "legacy" construction
    described in draft-agl-tls-chacha20poly1305.

    :param ciphertext: authenticated ciphertext
    :type ciphertext: bytes
    :param aad:
    :type aad: Optional[bytes]
    :param nonce:
    :type nonce: bytes
    :param key:
    :type key: bytes
    :return: message
    :rtype: bytes
    r>   r   r?   Nr!   r"   r#   r$   r%   r   r@   )r   r'   r(   r)   r*   r+   Ú%_aead_chacha20poly1305_CRYPTBYTES_MAXr,   r-   r   r   r   r   r/   r.   r   Ú$crypto_aead_chacha20poly1305_decryptr1   r2   rC   s              r;   rH   rH   E  s  € õ$ Ý�:�uÑ%Ô%Ø-Ý”ðñ ô ð õ ˆz‰?Œ?€Då
ØÕ5Ò5Ø2×9Ò9Ý1ñ	
ô 	
õ ”ðñ ô ð õ Ý�3�ÑÔÐ/ 3¨$ ;Ø/Ý”ðñ ô ð õ Ý�5�%Ñ Ô ð 	AÝ�‰JŒJÕ@Ò@Ø6×=Ò=Ý2ñ	
ô 	
õ ”ðñ ô ð õ Ý�3�ÑÔð 	>Ý�‰HŒHÕ=Ò=Ø4×;Ò;Ý1ñ	
ô 	
õ ”ðñ ô ð ð Õ6Ñ6€EåŒ7Ð)Ñ*Ô*€DÝŒgÐ'¨Ñ/Ô/€Gà
ð ØˆÝ�C‘”ˆˆåŒxˆØˆå
Ô
2Ø�•s”x ¨T°4¸ÀÀsñô €Cõ ˆ3�!Š8Ð)µ3´?ÐCÑCÔCÐCåŒ:�g˜t AœwÑ'Ô'¨¨¨Ô*Ð*r<   c                 ót  — t          t          | t          ¦  «        dt          j        ¬¦  «         t          | ¦  «        }t          |t          k    d                     t          ¦  «        t          j        ¬¦  «         t          t          |t          ¦  «        p|du dt          j        ¬¦  «         t          t          |t          ¦  «        ot          |¦  «        t          k    d                     t          ¦  «        t          j        ¬¦  «         t          t          |t          ¦  «        ot          |¦  «        t          k    d                     t          ¦  «        t          j        ¬¦  «         |r|}t          |¦  «        }nt          j        }d}t          | ¦  «        }|t          z   }t          j        d	¦  «        }t          j        d
|¦  «        }	t          j        |	|| |||t          j        ||¦	  «	        }
t          |
dk    dt          j        ¬¦  «         t          j        |	|d         ¦  «        dd…         S )aD  
    Encrypt the given ``message`` using the long-nonces xchacha20poly1305
    construction.

    :param message:
    :type message: bytes
    :param aad:
    :type aad: Optional[bytes]
    :param nonce:
    :type nonce: bytes
    :param key:
    :type key: bytes
    :return: authenticated ciphertext
    :rtype: bytes
    r   r   r    Nr!   r"   r#   r   r$   r%   r&   )r   r'   r(   r)   r*   r+   r   r,   r-   r   r   r   r.   r   r/   r   Ú*crypto_aead_xchacha20poly1305_ietf_encryptr1   r2   r3   s              r;   rJ   rJ   ”  s%  € õ$ Ý�7�EÑ"Ô"Ø*Ý”ðñ ô ð õ ˆw‰<Œ<€Då
ØÕCÒCØ/×6Ò6Ý?ñ	
ô 	
õ ”ðñ ô ð õ Ý�3�ÑÔÐ/ 3¨$ ;Ø/Ý”ðñ ô ð õ Ý�5�%Ñ Ô ð 	GÝ�‰JŒJÕFÒFØ6×=Ò=Ý8ñ	
ô 	
õ ”ðñ ô ð õ Ý�3�ÑÔð 	DÝ�‰HŒHÕCÒCØ4×;Ò;Ý7ñ	
ô 	
õ ”ðñ ô ð ð ð ØˆÝ�C‘”ˆˆåŒxˆØˆåˆw‰<Œ<€DØÕ<Ñ<€EåŒ7Ð)Ñ*Ô*€Då”Ð*¨EÑ2Ô2€Jå
Ô
8Ø�D˜' 4¨¨uµc´hÀÀsñô €Cõ ˆ3�!Š8Ð)µ3´?ÐCÑCÔCÐCÝŒ:�j $ q¤'Ñ*Ô*¨1¨1¨1Ô-Ð-r<   c                 óV  — t          t          | t          ¦  «        dt          j        ¬¦  «         t          | ¦  «        }t          |t          k    d                     t          ¦  «        t          j        ¬¦  «         t          t          |t          ¦  «        p|du dt          j        ¬¦  «         t          t          |t          ¦  «        ot          |¦  «        t          k    d                     t          ¦  «        t          j        ¬¦  «         t          t          |t          ¦  «        ot          |¦  «        t          k    d                     t          ¦  «        t          j        ¬¦  «         |t          z
  }t          j        d¦  «        }t          j        d	|¦  «        }|r|}t          |¦  «        }	nt          j        }d
}	t          j        ||t          j        | |||	||¦	  «	        }
t          |
d
k    dt          j        ¬¦  «         t          j        ||d
         ¦  «        dd…         S )aU  
    Decrypt the given ``ciphertext`` using the long-nonces xchacha20poly1305
    construction.

    :param ciphertext: authenticated ciphertext
    :type ciphertext: bytes
    :param aad:
    :type aad: Optional[bytes]
    :param nonce:
    :type nonce: bytes
    :param key:
    :type key: bytes
    :return: message
    :rtype: bytes
    r>   r   r?   Nr!   r"   r#   r$   r%   r   r@   )r   r'   r(   r)   r*   r+   Ú+_aead_xchacha20poly1305_ietf_CRYPTBYTES_MAXr,   r-   r   r   r   r   r/   r.   r   Ú*crypto_aead_xchacha20poly1305_ietf_decryptr1   r2   rC   s              r;   rM   rM   ä  s  € õ$ Ý�:�uÑ%Ô%Ø-Ý”ðñ ô ð õ ˆz‰?Œ?€Då
ØÕ;Ò;Ø2×9Ò9Ý7ñ	
ô 	
õ ”ðñ ô ð õ Ý�3�ÑÔÐ/ 3¨$ ;Ø/Ý”ðñ ô ð õ Ý�5�%Ñ Ô ð 	GÝ�‰JŒJÕFÒFØ6×=Ò=Ý8ñ	
ô 	
õ ”ðñ ô ð õ Ý�3�ÑÔð 	DÝ�‰HŒHÕCÒCØ4×;Ò;Ý7ñ	
ô 	
õ ”ðñ ô ð ð Õ<Ñ<€EÝŒ7Ð)Ñ*Ô*€DÝŒgÐ'¨Ñ/Ô/€Gà
ð ØˆÝ�C‘”ˆˆåŒxˆØˆå
Ô
8Ø�•s”x ¨T°4¸ÀÀsñô €Cõ ˆ3�!Š8Ð)µ3´?ÐCÑCÔCÐCåŒ:�g˜t AœwÑ'Ô'¨¨¨Ô*Ð*r<   N)4Útypingr   Únaclr   r)   Únacl._sodiumr   r   Únacl.exceptionsr   Ú*crypto_aead_chacha20poly1305_ietf_keybytesr   ÚintÚ__annotations__Ú+crypto_aead_chacha20poly1305_ietf_nsecbytesr	   Ú+crypto_aead_chacha20poly1305_ietf_npubbytesr
   Ú(crypto_aead_chacha20poly1305_ietf_abytesr   Ú2crypto_aead_chacha20poly1305_ietf_messagebytes_maxr   rA   Ú%crypto_aead_chacha20poly1305_keybytesr   Ú&crypto_aead_chacha20poly1305_nsecbytesr   Ú&crypto_aead_chacha20poly1305_npubbytesr   Ú#crypto_aead_chacha20poly1305_abytesr   Ú-crypto_aead_chacha20poly1305_messagebytes_maxr   rG   Ú+crypto_aead_xchacha20poly1305_ietf_keybytesr   Ú,crypto_aead_xchacha20poly1305_ietf_nsecbytesr   Ú,crypto_aead_xchacha20poly1305_ietf_npubbytesr   Ú)crypto_aead_xchacha20poly1305_ietf_abytesr   Ú3crypto_aead_xchacha20poly1305_ietf_messagebytes_maxr   rL   r(   r0   rB   rE   rH   rJ   rM   © r<   r;   ú<module>rd      s”  ðð Ð Ð Ð Ð Ð Ð à "Ð "Ð "Ð "Ð "Ð "Ø !Ð !Ð !Ð !Ð !Ð !Ð !Ð !Ø "Ð "Ð "Ð "Ð "Ð "ðð 3€CÔ2Ñ4Ô4ð +¨Cð ð ñ ð 4€CÔ3Ñ5Ô5ð ,¨Sð ð ñ ð 4€CÔ3Ñ5Ô5ð ,¨Sð ð ñ ð 1€CÔ0Ñ2Ô2ð )¨#ð ð ñ ð ;€CÔ:Ñ<Ô<ð 3°Cð ð ñ ð 7Ø.ñ/ð +ð .€CÔ-Ñ/Ô/ð & sð ð ñ ð /€CÔ.Ñ0Ô0ð '¨ð ð ñ ð /€CÔ.Ñ0Ô0ð '¨ð ð ñ ð ,€CÔ+Ñ-Ô-ð $ Sð ð ñ ð 6€CÔ5Ñ7Ô7ð .¨sð ð ñ ð 2Ø)ñ*ð &ð 4€CÔ3Ñ5Ô5ð ,¨Sð ð ñ ð 5€CÔ4Ñ6Ô6ð -¨cð ð ñ ð 5€CÔ4Ñ6Ô6ð -¨cð ð ñ ð 2€CÔ1Ñ3Ô3ð *¨3ð ð ñ ð <€CÔ;Ñ=Ô=ð 4°Sð ð ñ ð 8Ø/ñ0ð ,ðL.ØðL.Ø! %œðL.Ø16ðL.Ø=BðL.à
ðL.ð L.ð L.ð L.ð^L+ØðL+Ø$ UœOðL+Ø49ðL+Ø@EðL+à
ðL+ð L+ð L+ð L+ð^M.ØðM.Ø! %œðM.Ø16ðM.Ø=BðM.à
ðM.ð M.ð M.ð M.ð`L+ØðL+Ø$ UœOðL+Ø49ðL+Ø@EðL+à
ðL+ð L+ð L+ð L+ð^M.ØðM.Ø! %œðM.Ø16ðM.Ø=BðM.à
ðM.ð M.ð M.ð M.ð`K+ØðK+Ø$ UœOðK+Ø49ðK+Ø@EðK+à
ðK+ð K+ð K+ð K+ð K+ð K+r<   