PyCryptodome安裝使用方法


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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM