Welcome to PEP272 Encryption’s documentation!

https://img.shields.io/travis/Varbin/pep272-encryption.svg https://img.shields.io/codecov/c/github/Varbin/pep272-encryption/master.svg https://ci.appveyor.com/api/projects/status/github/Varbin/pep272-encryption?svg=true

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 licensed under CC0 (public domain).

Structure

This documentation is structured.

It starts with the Installation instructions. The second chapter is Tutorial, giving a quick example without explaining too much. The How-To gives practical solutions to common problems. Look up in the Library reference. The Discussions section explains in-depth knowledge of topics important in the context of the library to get a deeper understanding of the software.

Changelog

0.3

  • New: PEP272Cipher is a new style class on Python 2.

0.2 (latest stable)

  • New: Documentation
  • New: Optional extensions module for more speed. CBC and CFB are now two times faster!
  • Changed: PEP272Cipher.IV is static now.

0.1

  • Initial release.

Indices and tables