diff --git a/settings/common.py b/settings/common.py index 13d4d04..02240ad 100644 --- a/settings/common.py +++ b/settings/common.py @@ -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", # diff --git a/src/common/crypto.py b/src/common/crypto.py index 23f416b..cab4895 100644 --- a/src/common/crypto.py +++ b/src/common/crypto.py @@ -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')