pip windows 安装_关于python安装pip及crypto库

182e835ea16d6577de64a28b830abc50.png

关于python安装pip及crypto库

Capture The Flag (CTF) 常用到的crypto库,有很多技术人员不知道怎么安装。而crypto库已经有三五年没有团队维护更新,网络上很多旧版安装方法不可用。本篇记录了作者安装pip及PyCryptodome库的过程。最新安装测试于2020.7,新版适用。Linux系统,Windows系统均有记录。

判断系统是否已安装pip:

pip --version

下载并安装pip,linux和windows系统的操作方法详见代码:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

#下载安装脚本//Linux/Windows

运行安装脚本(此处pip关联的是python3):

sudo python3 get-pip.py #运行安装脚本//Linuxget-pip.py //Windows

升级pip至最新版:

sudo apt-get install python-pip //Linuxpip install -U pip//Linuxsudo easy_install --upgrade pip//Linuxpython -m pip install --upgrade pip //Windows

安装PyCryptodome:

pip install PyCryptodome

测试:

from Crypto.Cipher import AESimport base64aes_instance = AES.new(b'密钥, AES.MODE_ECB)cipher = base64.b64decode('密文')plaintext = aes_instance.decrypt(cipher)print(plaintext)//输出明文

Ps:

pip常用 命令

pip --version #显示版本和路径pip --help #获取帮助

安装包

pip install name #最新版本pip install 'name==1.0.4' #指定版本pip install 'mane>=1.0.4' #最小版本

升级包

pip install --upgrade name

卸载包

pip uninstall name

搜索包

pip search name

显示包信息

pip show

显示指定包信息

pip show -f name

查看已安装包

pip list -o

pip升级

pip install --upgrade pip//Linuxpython -m pip install -U pip//Windows

对于包,使用==, >=, <=, >, < 以指定版本号。


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

By:官方文档:Compatibility with PyCrypto

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值