way to insight


Python 加密库之 PyCryptodome


作为 PyCrypto 的继任者,PyCryptodome 有相当大的潜力。


  • Legrandin/pycryptodome: A self-contained cryptographic library for Python

    PyCryptodome is a fork of PyCrypto. It brings the following enhancements with respect to the last official version of PyCrypto (2.6.1)

  • Crypto.Util.Padding.pad(data_to_pad, block_size, style=’pkcs7’)

    style (string) – Padding algorithm. It can be ‘pkcs7’ (default), ‘iso7816’ or ‘x923’.

    默认就是支持 pkcs7 填充算法的。

  • PyCryptodome’s documentation

    It supports Python 2.6 or newer, all Python 3 versions and PyPy.

    The installation procedure depends on the package you want the library to be in. PyCryptodome can be used as:

    • an almost drop-in replacement for the old PyCrypto library. You install it with:

    pip install pycryptodome

    In this case, all modules are installed under the Crypto package.

    One must avoid having both PyCrypto and PyCryptodome installed at the same time, as they will interfere with each other.

    This option is therefore recommended only when you are sure that the whole application is deployed in a virtualenv.

    • a library independent of the old PyCrypto. You install it with:

    pip install pycryptodomex

    In this case, all modules are installed under the Cryptodome package. PyCrypto and PyCryptodome can coexist.

    PyCryptodome is not a wrapper to a separate C library like OpenSSL. To the largest possible extent, algorithms are implemented in pure Python. Only the pieces that are extremely critical to performance (e.g. block ciphers) are implemented as C extensions.

  • pycryptodome 3.5.1 : Python Package Index

  • Python 3: An Intro to Encryption | The Mouse Vs. The Python


    Fortunately there is a fork of the project called PyCrytodome that is a drop-in replacement for PyCrypto.

    The cryptography package aims to be “cryptography for humans” much like the requests library is “HTTP for Humans”. The idea is that you will be able to create simple cryptographic recipes that are safe and easy-to-use. If you need to, you can drop down to low=level cryptographic primitives, which require you to know what you’re doing or you might end up creating something that’s not very secure.

  • Python RSA文件加密 | 风中老狼的博客


  • Flask 前端RSA加密后端Python解密示例 - CSDN博客