Skip to main content

Library for easy creation of PEP-272 cipher classes

Project description

https://img.shields.io/travis/Varbin/pep272-encryption.svg https://img.shields.io/codecov/c/github/Varbin/pep272-encryption/master.svg

To prevent reinventing the wheel to create a PEP-272 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):
...        return encrypt_aes(key, block)
...
...    def decrypt_block(self, key, block):
...        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 licensed under CC0 (public domain).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pep272-encryption-0.1.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

pep272_encryption-0.1-py2.py3-none-any.whl (6.5 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page