| Server IP : 217.160.0.135 / Your IP : 216.73.217.85 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1074145052 ( 1074145052) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/lib/python3/dist-packages/Cryptodome/Cipher/__pycache__/ |
Upload File : |
�
8�tc�* � � � d Z dgZddlmZ ddlmZmZmZmZm Z m
Z
mZmZ ddl
mZ edd� � Z G d� de� � Zd � Zd
S )z'
Ciphertext Block Chaining (CBC) mode.
�CbcMode� )�_copy_bytes)�load_pycryptodome_raw_lib�VoidPointer�create_string_buffer�get_raw_buffer�SmartPointer�c_size_t�c_uint8_ptr�is_writeable_buffer)�get_random_byteszCryptodome.Cipher._raw_cbca�
int CBC_start_operation(void *cipher,
const uint8_t iv[],
size_t iv_len,
void **pResult);
int CBC_encrypt(void *cbcState,
const uint8_t *in,
uint8_t *out,
size_t data_len);
int CBC_decrypt(void *cbcState,
const uint8_t *in,
uint8_t *out,
size_t data_len);
int CBC_stop_operation(void *state);
c �( � e Zd ZdZd� Zdd�Zdd�ZdS )r a[ *Cipher-Block Chaining (CBC)*.
Each of the ciphertext blocks depends on the current
and all previous plaintext blocks.
An Initialization Vector (*IV*) is required.
See `NIST SP800-38A`_ , Section 6.2 .
.. _`NIST SP800-38A` : http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf
:undocumented: __init__
c �Z � t � � | _ t � |� � � t |� � t
t |� � � � | j � � � � � }|rt d|z � � �t | j � � � t j � � | _ |� � � t |� � | _
t dd|� � | _ | j | _ | j | j g| _ dS )a Create a new block cipher, configured in CBC mode.
:Parameters:
block_cipher : C pointer
A smart pointer to the low-level block cipher instance.
iv : bytes/bytearray/memoryview
The initialization vector to use for encryption or decryption.
It is as long as the cipher block.
**The IV must be unpredictable**. Ideally it is picked randomly.
Reusing the *IV* for encryptions performed with the same key
compromises confidentiality.
z)Error %d while instantiating the CBC modeN)r �_state�raw_cbc_lib�CBC_start_operation�getr r
�len�
address_of�
ValueErrorr �CBC_stop_operation�release�
block_sizer �iv�IV�encrypt�decrypt�_next)�self�block_cipherr �results �=/usr/lib/python3/dist-packages/Cryptodome/Cipher/_mode_cbc.py�__init__zCbcMode.__init__N s
� �"