Last updated:
0 purchases
pep272encryption 0.4
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+.'
License
This project is CC0 licensed
(= public domain).
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.