3
©ÞX¼  ã               @   s\   d dl mZmZmZ d dlZd dlZG dd„ dejƒ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| jƒ S | jƒ S d S )N)ÚsixÚPY3Z__unicode__Ú	__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| jdƒS | S d S )NÚascii)r   r   Údecode)Zbytes_inr   r   r   Úbytes_as_string;   s    
r   é    c             C   s   t jj| ƒS )N)ÚnaclZbindingsZrandombytes)Úsizer   r   r   ÚrandomB   s    r!   )r   )Z
__future__r   r   r   r   Znacl.bindingsr   Zbinary_typer   Úobjectr   r   r!   r   r   r   r   Ú<module>   s   	