
     h                     N    d dl mZmZmZmZ d dlZddlmZ ddlm	Z	m
Z
 dgZd ZdS )    )unicode_literalsdivisionabsolute_importprint_functionN   )pretty_message)	type_name	int_types
rand_bytesc                     t          | t                    s*t          t          dt	          |                               | dk     rt          d          | dk    rt          d          t          j        |           S )a}  
    Returns a number of random bytes suitable for cryptographic purposes

    :param length:
        The desired number of bytes

    :raises:
        ValueError - when any of the parameters contain an invalid value
        TypeError - when any of the parameters are of the wrong type
        OSError - when an error is returned by OpenSSL

    :return:
        A byte string
    z;
            length must be an integer, not %s
            r   zlength must be greater than 0i   z$length must not be greater than 1024)
isinstancer
   	TypeErrorr   r	   
ValueErrorosurandom)lengths    J/var/www/html/Sam_Eipo/venv/lib/python3.11/site-packages/oscrypto/_rand.pyr   r      s      fi((  f	
 
   	 zz8999}}?@@@:f    )
__future__r   r   r   r   r   _errorsr   _typesr	   r
   __all__r    r   r   <module>r      s    R R R R R R R R R R R R 				 # # # # # # ( ( ( ( ( ( ( ( 
    r   