HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/alt/python38/lib64/python3.8/site-packages/Crypto/Random/__pycache__/random.cpython-38.pyc
U

��_s�@s�dZdZdddddddgZd	d
lmZd	dlZejd	dkrRejd
d
krRd	dlTGdd�de�Z	e	�Z
e
jZe
jZe
j
Z
e
jZe
jZe
jZd	dlmZmZmZmZdS)zHA cryptographically strong version of Python's standard "random" module.z$Id$�StrongRandom�getrandbits�	randrange�randint�choice�shuffle�sample�)�RandomN��)�*c@sFeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)rNcCsV|dkr|dkrd|_n:|dk	r0|dkr0||_n"|dkrJ|dk	rJ|j|_ntd��dS)Nz(Cannot specify both 'rng' and 'randfunc')�	_randfunc�read�
ValueError)�self�rngZrandfunc�r�G/opt/alt/python38/lib64/python3.8/site-packages/Crypto/Random/random.py�__init__$s
zStrongRandom.__init__cCs:|jdkrt��j|_d|>d}|t|�t|d���@S)z0Return a python long integer with k random bits.Nr�)r
r	�newr�
bytes_to_long�ceil_div)r�k�maskrrrr.s
zStrongRandom.getrandbitscGs�t|�dkr|\}}}nHt|�dkr2|\}}d}n.t|�dkrN|\}d}d}ntdt|�f��t|t�r~t|t�r~t|t�s�td��|dkr�td��t|||�}|dkr�d}|dkr�td|||f��|}||kr�|�t|��}q�|||S)	zkrandrange([start,] stop[, step]):
        Return a randomly-selected element from range(start, stop, step).�r
rrz.randrange expected at most 3 arguments, got %dz$randrange requires integer argumentsz(randrange step argument must not be zeroz%empty range for randrange(%r, %r, %r))�len�	TypeError�
isinstance�intrrr�size)r�args�start�stop�step�num_choices�rrrrr5s6
��zStrongRandom.randrangecCsJt|t�rt|t�std��|�||d�}||kr@|ksFnt�|S)z0Return a random integer N such that a <= N <= b.z"randint requires integer argumentsr)rrrr�AssertionError)r�a�b�NrrrrWs
zStrongRandom.randintcCs&t|�dkrtd��||�t|��S)zrReturn a random element from a (non-empty) sequence.

        If the seqence is empty, raises IndexError.
        rzempty sequence)r�
IndexErrorr)r�seqrrrr_szStrongRandom.choicecCs6t|�}tt|��D]}|�|�t|���||<qdS)zShuffle the sequence in place.N)�list�ranger�popr)r�x�items�irrrrhszStrongRandom.shufflecCsht|�}||krtd��g}i}t|�D]:}d}|dks@||krL|�|�}q0|�||�d||<q(|S)zNReturn a k-length list of unique elements chosen from the population sequence.zsample larger than populationNr)rrr.r�append)rZ
populationrr%�retvalZselectedr2r&rrrrrs
zStrongRandom.sample)NN)
�__name__�
__module__�__qualname__rrrrrrrrrrrr#s

"	
)rr�
long_to_bytesr )�__doc__�__revision__�__all__�Cryptor	�sys�version_infoZCrypto.Util.py21compat�objectrZ_rrrrrrrZCrypto.Util.numberrrr8r rrrr�<module>s`