Submit
Path:
~
/
/
opt
/
alt
/
python37
/
lib64
/
python3.7
/
site-packages
/
Crypto
/
Util
/
__pycache__
/
File Content:
Counter.cpython-37.pyc
B ��c$ � @ sz d Z ddlZejd dkr0ejd dkr0ddlT ddlT ddlmZ ddlZed�ed�dddddfd d �Z d dd�Z dS )a� Fast counter functions for CTR cipher modes. CTR is a chaining mode for symmetric block encryption or decryption. Messages are divideded into blocks, and the cipher operation takes place on each block using the secret key and a unique *counter block*. The most straightforward way to fulfil the uniqueness property is to start with an initial, random *counter block* value, and increment it as the next block is processed. The block ciphers from `Crypto.Cipher` (when configured in *MODE_CTR* mode) invoke a callable object (the *counter* parameter) to get the next *counter block*. Unfortunately, the Python calling protocol leads to major performance degradations. The counter functions instantiated by this module will be invoked directly by the ciphers in `Crypto.Cipher`. The fact that the Python layer is bypassed lead to more efficient (and faster) execution of CTR cipher modes. An example of usage is the following: >>> from Crypto.Cipher import AES >>> from Crypto.Util import Counter >>> >>> pt = b'