
cryptography is a package designed to expose cryptographic primitives and recipes to Python developers.
.. image:: https://img.shields.io/pypi/v/cryptography.svg :target: https://pypi.org/project/cryptography/ :alt: Latest Version
.. image:: https://readthedocs.org/projects/cryptography/badge/?version=latest :target: https://cryptography.io :alt: Latest Docs
.. image:: https://github.com/pyca/cryptography/actions/workflows/ci.yml/badge.svg :target: https://github.com/pyca/cryptography/actions/workflows/ci.yml?query=branch%3Amain
cryptography 是一个包,为 Python 开发者提供加密配方和原语。我们的目标是让它成为你的“加密标准库”。它支持 Python 3.9+ 和 PyPy3 7.3.11+。
cryptography 包括高级配方和低级接口,用于常见的加密算法,如对称加密、消息摘要和密钥派生函数。例如,要使用 cryptography 的高级对称加密配方加密某些内容:
.. code-block:: pycon
>>> from cryptography.fernet import Fernet
>>> # Put this somewhere safe!
>>> key = Fernet.generate_key()
>>> f = Fernet(key)
>>> token = f.encrypt(b"A really secret message. Not for prying eyes.")
>>> token
b'...'
>>> f.decrypt(token)
b'A really secret message. Not for prying eyes.'
你可以在 文档_ 中找到更多信息。
你可以通过以下方式安装 cryptography:
.. code-block:: console
$ pip install cryptography
完整细节请参见 安装文档_。
讨论
如果你遇到错误,可以在我们的 `问题跟踪器`_ 中提交。
我们维护一个 `cryptography-dev`_ 邮件列表用于开发讨论。
你也可以加入 ``#pyca`` on ``irc.libera.chat`` 来提问或参与。
安全
~~~~~~~~
需要报告安全问题?请查阅我们的 `安全报告`_ 文档。
.. _`文档`: https://cryptography.io/
.. _`安装文档`: https://cryptography.io/en/latest/installation/
.. _`问题跟踪器`: https://github.com/pyca/cryptography/issues
.. _`cryptography-dev`: https://mail.python.org/mailman/listinfo/cryptography-dev
.. _`安全报告`: https://cryptography.io/en/latest/security/