Skip to main content

pyCrypto wrapper, used by various libraries

Project description


This library is pycrypto / pycryptodome wrapper that standardises the encryption and allows easy extentions to support additional encryption schemes.


  • This library contains a set of Ciphers. Each Cipher has
    • encrpyt and decrypt functions that MUST return/accept byte array and
    • encrpyt_string / decrypt_string that work with string objects that will be a base64 representation of the encrypted byte output of the underlying [en|de]crypt functions
    • If your cipher returns structured data (such as IV and other data), you SHOULD use namedtuples and extend them with MsgPackNamedTuple mixin. This will allow you to easly dump the named tuple into optimised byterarray, in order to be flexable with the object, currently we are converting the named tuple into dict in order to be able to add fields in the feature
    • You SHOULD provide key generation function as part of the cipher that will generate key (the function may perform external calls in case of cloud kms and etc.)

Current Ciphers

  • Symmetric - AES-CTR encryption with 256 bits (32 bytes) key length
  • Asymmetric - PKCS1_OAEP encryption with SHA512 hashAlgo
  • Envelope - Envelope encryption where the body is encrypted with the Symmetric cipher. the DEK (data encryption key) is encrypted using non-specific cipher provided during init

PyCryptoDome vs PyCrypto vs None

  • When installing, no cryptography package is provided by default. Use mlcrypto[pycryptodome] or mlcrypto[pycrypto] to ensure one is installed or use the default if you know you have one installed
  • As pycrypto is dead, prefer using pycryptodome and expect some issues (The main one is encrypted ssh private keys) not to work

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 mlcrypto, version 0.6.297
Filename, size File type Python version Upload date Hashes
Filename, size mlcrypto-0.6.297.tar.gz (5.0 kB) File type Source Python version None Upload date Hashes View
Filename, size mlcrypto-0.6.297-py2.py3-none-any.whl (7.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View

Supported by

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