Skip to main content

Library for easy creation of PEP-272 cipher classes

Project description

Github Actions: QA Maintainability Test Coverage Documentation Status

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).

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.

Files for pep272-encryption, version 0.4
Filename, size File type Python version Upload date Hashes
Filename, size pep272_encryption-0.4-cp35-abi3-macosx_10_6_intel.whl (16.6 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size pep272_encryption-0.4-cp35-abi3-macosx_10_9_universal2.whl (16.8 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size pep272_encryption-0.4-cp35-abi3-manylinux1_i686.whl (21.1 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size pep272_encryption-0.4-cp35-abi3-manylinux1_x86_64.whl (21.5 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size pep272_encryption-0.4-cp35-abi3-manylinux2014_aarch64.whl (27.0 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size pep272_encryption-0.4-cp35-abi3-manylinux2014_ppc64le.whl (27.1 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size pep272_encryption-0.4-cp35-abi3-manylinux2014_s390x.whl (26.1 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size pep272_encryption-0.4-cp35-abi3-win32.whl (17.8 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size pep272_encryption-0.4-cp35-abi3-win_amd64.whl (18.2 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size pep272_encryption-0.4-py2.pp35.pp36.pp37.pp38.pp39-none-any.whl (36.9 kB) File type Wheel Python version py2.pp35.pp36.pp37.pp38.pp39 Upload date Hashes View
Filename, size pep272-encryption-0.4.tar.gz (14.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page