新增密码加密配置

This commit is contained in:
chenzuoqing 2021-12-21 15:52:53 +08:00
parent 447b8b265a
commit 5b03e4add4
2 changed files with 11 additions and 0 deletions

View File

@ -11,6 +11,9 @@ CONFIG: dict = load_yaml(CONFIG_FILE, raise_exception=True, default={})
VERSION = "v1"
INSTANCE = "9e5da0b3-565f-11ec-b095-18c04d9eb245"
# 请注意修改,涉及加密
SECRET_KEY = "_%77bE8b62Z!11eCbdF4/18C04@d9b24"
# API static token 允许请求的静态token
X_TOKEN_SET = (
"51ab21fa323a11eca1af000c2993d583", #

View File

@ -4,6 +4,8 @@ from os import urandom
from hashlib import md5
from Crypto.Cipher import AES
from settings.common import SECRET_KEY
"""pip3 install pycryptodome"""
@ -92,6 +94,12 @@ class AESCipher:
return out_file.getvalue()
def quick_crypto(content):
cipher = AESCipher(content=content, password=SECRET_KEY)
result = cipher.encrypt()
return result.decode()
if __name__ == '__main__':
print("++++++++++++++++++++++++++++++++++++++++++")
aes = AESCipher("hello world2223", '111111')