From efb9f48c6f09189b93302e609237e213fb72670a Mon Sep 17 00:00:00 2001 From: Bai Date: Fri, 22 Jan 2021 15:57:29 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=88=A0=E9=99=A4`pycryptodome`?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E5=8C=85=E5=AE=89=E8=A3=85(=E5=9B=A0?= =?UTF-8?q?=E4=B8=BA`pycryptodome`=E5=92=8C`pycrypto`=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E5=8C=85=E7=9B=AE=E5=BD=95=E5=86=B2=E7=AA=81);=E5=8F=AA?= =?UTF-8?q?=E5=AE=89=E8=A3=85=20`pycryptodomex`=E4=BE=9D=E8=B5=96=E5=8C=85?= =?UTF-8?q?;=20=E4=BF=AE=E6=94=B9=20`from=20crypto`=20=E4=B8=BA=20`from=20?= =?UTF-8?q?cryptodome`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/authentication/utils.py | 6 +++--- apps/common/utils/crypto.py | 6 +++--- requirements/requirements.txt | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/authentication/utils.py b/apps/authentication/utils.py index f6750a73d..f8571d6d7 100644 --- a/apps/authentication/utils.py +++ b/apps/authentication/utils.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- # import base64 -from Crypto.PublicKey import RSA -from Crypto.Cipher import PKCS1_v1_5 -from Crypto import Random +from Cryptodome.PublicKey import RSA +from Cryptodome.Cipher import PKCS1_v1_5 +from Cryptodome import Random from common.utils import get_logger diff --git a/apps/common/utils/crypto.py b/apps/common/utils/crypto.py index 6d8d876ef..744e6c367 100644 --- a/apps/common/utils/crypto.py +++ b/apps/common/utils/crypto.py @@ -1,7 +1,7 @@ import base64 -from Crypto.Cipher import AES -from Crypto.Util.Padding import pad -from Crypto.Random import get_random_bytes +from Cryptodome.Cipher import AES +from Cryptodome.Util.Padding import pad +from Cryptodome.Random import get_random_bytes from gmssl.sm4 import CryptSM4, SM4_ENCRYPT, SM4_DECRYPT from django.conf import settings diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 9a3eeb1b9..7c6771c77 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -53,7 +53,6 @@ Pillow==7.1.0 pyasn1==0.4.8 pycparser==2.19 pycrypto==2.6.1 -pycryptodome==3.9.9 pycryptodomex==3.9.9 pyotp==2.2.6 PyNaCl==1.2.1