Welcome to PEP272 Encryption’s documentation!¶
To prevent reinventing the wheel while creating a PEP-272 interface for a new block cipher encryption, this library aims to create an extensible framework for new libraries.
Currently following modes of operation are supported:
- ECB
- CBC
- CFB
- OFB
- CTR
The PGP mode of operation is not supported. It may be added in the future.
Example¶
In this example encrypt_aes(key, block)
will encrypt one block of AES while
decrypt_aes(key, block)
will decrypt one.
>>> from pep272_encryption import PEP272Cipher, MODE_ECB
>>> class AESCipher:
... """
... PEP-272 cipher class for AES
... """
... block_size = 16
...
... def encrypt_block(self, key, block, **kwargs):
... return encrypt_aes(key, block)
...
... def decrypt_block(self, key, block, **kwargs):
... return decrypt_aes(key, block)
...
>>> cipher = AESCipher(b'\00'*16, MODE_ECB)
>>> cipher.encrypt(b'\00'*16)
b'f\xe9K\xd4\xef\x8a,;\x88L\xfaY\xca4+.'
Structure¶
This documentation is structured.
It starts with the Installation instructions. In the second chapter there are examples and guides. Look up in the Library reference. The Discussion section explains in-depth knowledge of topics important in the context of the library to get a deeper understanding of the software.
Changelog¶
0.4¶
New¶
- Type hints
- Build manylinux wheels, universal wheel is limited to Python 2 and PyPy
- In addition to callables, the counter argument for CTR mode now accepts counters from PyCryptodome now
Changed¶
- Extension module is in pure C, instead of being written in Cython
- __init__ signature is slightly different: IV can be given as a positional argument
0.3 - 2019-06-14¶
Added¶
PEP272Cipher
is a new style class on Python 2.- Documentation
- Optional extensions module for more speed. CBC and CFB are now two times faster!
Changed¶
PEP272Cipher.IV
does not change in mode using a CBC
0.1 - 2019-03-03¶
- Initial release.