码迷,mamicode.com
首页 > 其他好文 > 详细

PyCryptodome安装使用方法

时间:2019-10-05 10:28:47      阅读:787      评论:0      收藏:0      [点我收藏+]

标签:abc   官方   ecb   http   style   csp   target   number   nta   

PyCryptodome是PyCrypto的一个分支。基于PyCrypto2.6.1,多了以下特性:

  • Authenticated encryption modes (GCM, CCM, EAX, SIV)
  • Accelerated AES on Intel platforms via AES-NI
  • First class support for PyPy
  • SHA-3 hash algorithm
  • Salsa20 stream cipher
  • scrypt and HKDF
  • Deterministic DSA
  • Password-protected PKCS#8 key containers
  • Shamir’s Secret Sharing scheme
  • Random numbers get sourced directly from the OS (and not from a CSPRNG in userspace)
  • Simplified install process, including better support for Windows
  • Cleaner RSA and DSA key generation (largely based on FIPS 186-4)
  • Major clean ups and simplification of the code base

官方文档:Compatibility with PyCrypto

------------------

0x01 安装

pip install PyCryptodome

 

0x02 使用

跟PyCrypto2.6用法类似,以下以AES为例:

from Crypto.Cipher import AES
key=1234567890abcdef
obj=AES.new(key,AES.MODE_ECB)
cipher=obj.encrypt(message: pcat.cc)

 

PyCryptodome安装使用方法

标签:abc   官方   ecb   http   style   csp   target   number   nta   

原文地址:https://www.cnblogs.com/pcat/p/11623825.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!