U
    ­Ö«[›  ã                   @   sZ   d dl mZmZmZ d dlZd dlZG dd„ deƒZG dd„ deƒZ	dd„ Z
dd
d„ZdS )é    )Úabsolute_importÚdivisionÚprint_functionNc                   @   s4   e Zd ZdZedd„ ƒZedd„ ƒZedd„ ƒZdS )	ÚEncryptedMessageze
    A bytes subclass that holds a messaged that has been encrypted by a
    :class:`SecretBox`.
    c                 C   s   | |ƒ}||_ ||_|S ©N)Ú_nonceÚ_ciphertext)ÚclsÚnonceÚ
ciphertextZcombinedÚobj© r   ú,/usr/lib/python3/dist-packages/nacl/utils.pyÚ_from_parts   s    zEncryptedMessage._from_partsc                 C   s   | j S )zX
        The nonce used during the encryption of the :class:`EncryptedMessage`.
        )r   ©Úselfr   r   r   r
   #   s    zEncryptedMessage.noncec                 C   s   | j S )zP
        The ciphertext contained within the :class:`EncryptedMessage`.
        )r   r   r   r   r   r   *   s    zEncryptedMessage.ciphertextN)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úclassmethodr   Úpropertyr
   r   r   r   r   r   r      s   

r   c                   @   s   e Zd Zdd„ ZdS )ÚStringFixerc                 C   s   t jrt|  ¡ ƒS |  ¡ S d S r   )ÚsixÚPY3ÚstrÚ	__bytes__r   r   r   r   Ú__str__4   s    zStringFixer.__str__N)r   r   r   r   r   r   r   r   r   2   s   r   c                 C   s   t jr|  d¡S | S d S )NÚascii)r   r   Údecode)Zbytes_inr   r   r   Úbytes_as_string;   s    
r    é    c                 C   s
   t  | ¡S r   )ÚosÚurandom)Úsizer   r   r   ÚrandomB   s    r%   )r!   )Z
__future__r   r   r   r"   r   Úbytesr   Úobjectr   r    r%   r   r   r   r   Ú<module>   s   	