/usr/lib/python3/dist-packages/nacl/bindings/__pycache__
Edit: /usr/lib/python3/dist-packages/nacl/bindings/__pycache__/utils.cpython-310.pyc (3750B)
o
a @ s d dl mZ d dlmZmZ d dl mZ dededefddZ d ed
e
defddZd ed
e
defd
dZdedefddZ
dededefddZdS ) N)ffilib)ensureinp1inp2returnc C s t t| ttjd t t|ttjd tt| t|}td|}td|}t || t| t ||t| t| t|k}t
|||dk}|oO|S )zA
Compare contents of two memory regions in constant time
raisingzchar []r )r
isinstancebytesexc TypeErrormaxlenr newmemmover
sodium_memcmp)r r lnbuf1buf2eqLeqC r 5/usr/lib/python3/dist-packages/nacl/bindings/utils.pyr s r s blocksizec C s t t| ttjd t t|ttjd |dkrtjt| }|| }t d|}t dd}t
|| | t|||||}t |dkdtj
d t||d dd S )z
Pad the input bytearray ``s`` to a multiple of ``blocksize``
using the ISO/IEC 7816-4 algorithm
:param s: input bytes string
:type s: bytes
:param blocksize:
:type blocksize: int
:return: padded string
:rtype: bytes
r r unsigned char [] size_t [] zPadding failureN)r r
r r r
int
ValueErrorr r r r r
sodium_padCryptoErrorbuffer)r r s_lenm_lenbufp_lenrcr r r r! ) s r! c C sn t t| ttjd t t|ttjd t| }tdd}t
|| ||}|dkr/td| d|d S )z
Remove ISO/IEC 7816-4 padding from the input byte array ``s``
:param s: input bytes string
:type s: bytes
:param blocksize:
:type blocksize: int
:return: unpadded string
:rtype: bytes
r r r r zUnpadding failureN)r r
r r r
r r r r r sodium_unpadr" )r r r$ u_lenr( r r r r) C s
r) inpc C sV t t| ttjd t| }td|}t|| | t
|| t||dd S )ag
Increment the value of a byte-sequence interpreted
as the little-endian representation of a unsigned big integer.
:param inp: input bytes buffer
:type inp: bytes
:return: a byte-sequence representing, as a little-endian
unsigned big integer, the value ``to_int(inp)``
incremented by one.
:rtype: bytes
r r N)r r
r r r
r r r r r sodium_incrementr# )r+ r r&