https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/nacl/bindings/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/nacl/bindings/__pycache__/crypto_sign.cpython-310.pyc
o

��af(�@s�UddlmZddlmZddlmZmZddlm	Z	e�
�Zee
d<e��dZee
d<e��Zee
d<e��Zee
d	<e��Zee
d
<e��Zee
d<deeeffd
d�Zdedeeeffdd�Zdededefdd�Zdededefdd�Zdedefdd�Zdedefdd�Zdedefd d!�Zdedefd"d#�ZGd$d%�d%�Z d&e d'edd(fd)d*�Z!d&e dedefd+d,�Z"d&e d-edede#fd.d/�Z$d(S)0�)�Tuple)�
exceptions)�ffi�lib)�ensure�crypto_sign_BYTES��crypto_sign_SEEDBYTES�crypto_sign_PUBLICKEYBYTES�crypto_sign_SECRETKEYBYTES�crypto_sign_curve25519_BYTES� crypto_sign_ed25519ph_STATEBYTES�returncCs`t�dt�}t�dt�}t�||�}t|dkdtjd�t�	|t�dd�t�	|t�dd�fS)zu
    Returns a randomly generated public key and secret key.

    :rtype: (bytes(public_key), bytes(secret_key))
    �unsigned char[]r�Unexpected library error��raisingN)
r�newr
rr�crypto_sign_keypairr�exc�RuntimeError�buffer)�pk�sk�rc�r�;/usr/lib/python3/dist-packages/nacl/bindings/crypto_sign.pyr s�r�seedcCsxt|�tkrt�d��t�dt�}t�dt�}t�	|||�}t
|dkdtjd�t�|t�dd�t�|t�dd�fS)z�
    Computes and returns the public key and secret key using the seed ``seed``.

    :param seed: bytes
    :rtype: (bytes(public_key), bytes(secret_key))
    zInvalid seedrrrrN)
�lenr	r�
ValueErrorrrr
rr�crypto_sign_seed_keypairrrr)rrrrrrrr 2s
�r �messagercCs`t�dt|�t�}t�d�}t�|||t|�|�}t|dkdtjd�t�	||d�dd�S)z�
    Signs the message ``message`` using the secret key ``sk`` and returns the
    signed message.

    :param message: bytes
    :param sk: bytes
    :rtype: bytes
    r�unsigned long long *rrrN)
rrrrr�crypto_signrrrr)r!r�signed�
signed_lenrrrrr#Hs
	
r#r$rcCsVt�dt|��}t�d�}t�|||t|�|�dkrt�d��t�||d�dd�S)z�
    Verifies the signature of the signed message ``signed`` using the public
    key ``pk`` and returns the unsigned message.

    :param signed: bytes
    :param pk: bytes
    :rtype: bytes
    rr"r�Signature was forged or corruptN)rrrr�crypto_sign_openr�BadSignatureErrorr)r$rr!�message_lenrrrr'Zs	
�
r'�public_key_bytescC�Zt|�tkrt�d��t}t�d|�}t�||�}t	|dkdtj
d�t�||�dd�S)a
    Converts a public Ed25519 key (encoded as bytes ``public_key_bytes``) to
    a public Curve25519 key as bytes.

    Raises a ValueError if ``public_key_bytes`` is not of length
    ``crypto_sign_PUBLICKEYBYTES``

    :param public_key_bytes: bytes
    :rtype: bytes
    zInvalid curve public keyrrrrN)rr
rrrrrr�$crypto_sign_ed25519_pk_to_curve25519rrr)r*�curve_public_key_len�curve_public_keyrrrrr,o�
�r,�secret_key_bytescCr+)a
    Converts a secret Ed25519 key (encoded as bytes ``secret_key_bytes``) to
    a secret Curve25519 key as bytes.

    Raises a ValueError if ``secret_key_bytes``is not of length
    ``crypto_sign_SECRETKEYBYTES``

    :param secret_key_bytes: bytes
    :rtype: bytes
    zInvalid curve secret keyrrrrN)rrrrrrrr�$crypto_sign_ed25519_sk_to_curve25519rrr)r0�curve_secret_key_len�curve_secret_keyrrrrr1�r/r1cCs"t|�tkrt�d��|td�S)a	
    Extract the public Ed25519 key from a secret Ed25519 key (encoded
    as bytes ``secret_key_bytes``).

    Raises a ValueError if ``secret_key_bytes``is not of length
    ``crypto_sign_SECRETKEYBYTES``

    :param secret_key_bytes: bytes
    :rtype: bytes
    �Invalid secret keyN�rrrrr	�r0rrr�crypto_sign_ed25519_sk_to_pk��
r7cCs"t|�tkrt�d��|dt�S)z�
    Extract the seed from a secret Ed25519 key (encoded
    as bytes ``secret_key_bytes``).

    Raises a ValueError if ``secret_key_bytes``is not of length
    ``crypto_sign_SECRETKEYBYTES``

    :param secret_key_bytes: bytes
    :rtype: bytes
    r4Nr5r6rrr�crypto_sign_ed25519_sk_to_seed�r8r9c@s eZdZdZdgZddd�ZdS)�crypto_sign_ed25519ph_statezO
    State object wrapping the sha-512 state used in ed25519ph computation
    �staterNcCs2t�dt�|_t�|j�}t|dkdtjd�dS)Nrrrr)	rrr
r;r�crypto_sign_ed25519ph_initrrr)�selfrrrr�__init__�s
�z$crypto_sign_ed25519ph_state.__init__)rN)�__name__�
__module__�__qualname__�__doc__�	__slots__r>rrrrr:�sr:�edph�pmsgNcCsXtt|t�dtjd�tt|t�dtjd�t�|j|t	|��}t|dkdtj
d�dS)z�
    Update the hash state wrapped in edph

    :param edph: the ed25519ph state being updated
    :type edph: crypto_sign_ed25519ph_state
    :param pmsg: the partial message
    :type pmsg: bytes
    :rtype: None
    �/edph parameter must be a ed25519ph_state objectrz%pmsg parameter must be a bytes objectrrN)r�
isinstancer:r�	TypeError�bytesr�crypto_sign_ed25519ph_updater;rr)rDrErrrrrJ�s��rJcCs�tt|t�dtjd�tt|t�dtjd�tt|�tkd�t�tjd�t	�
dt�}t�
|j|t	j|�}t|dkdtjd�t	�|t�dd�S)	aR
    Create a signature for the data hashed in edph
    using the secret key sk

    :param edph: the ed25519ph state for the data
                 being signed
    :type edph: crypto_sign_ed25519ph_state
    :param sk: the ed25519 secret part of the signing key
    :type sk: bytes
    :return: ed25519ph signature
    :rtype: bytes
    rFrz+secret key parameter must be a bytes objectz secret key must be {} bytes longrrrN)rrGr:rrHrIrr�formatrrrr�"crypto_sign_ed25519ph_final_creater;�NULLrr)rDr�	signaturerrrrrL�s.��
���rLrNcCs�tt|t�dtjd�tt|t�dtjd�tt|�tkd�t�tjd�tt|t�dtjd�tt|�t	kd�t	�tjd�t
�|j||�}|dkrPt�
d��d	S)
a�
    Verify a prehashed signature using the public key pk

    :param edph: the ed25519ph state for the data
                 being verified
    :type edph: crypto_sign_ed25519ph_state
    :param signature: the signature being verified
    :type signature: bytes
    :param pk: the ed25519 public part of the signing key
    :type pk: bytes
    :return: True if the signature is valid
    :rtype: boolean
    :raises exc.BadSignatureError: if the signature is not valid
    rFrz*signature parameter must be a bytes objectzsignature must be {} bytes longz+public key parameter must be a bytes objectz public key must be {} bytes longrr&T)rrGr:rrHrIrrrKr
r�"crypto_sign_ed25519ph_final_verifyr;r()rDrNrrrrrrOs>��
��
��
rO)%�typingr�naclrr�nacl._sodiumrr�nacl.exceptionsr�crypto_sign_bytesr�int�__annotations__�crypto_sign_secretkeybytesr	�crypto_sign_publickeybytesr
r�crypto_box_secretkeybytesr� crypto_sign_ed25519ph_statebytesr
rIrr r#r'r,r1r7r9r:rJrL�boolrOrrrr�<module>sT
��
���
�)����

https://t.me/RX1948 - 2025