|
|
|
@ -579,28 +579,37 @@ def dePunycode(domain): |
|
|
|
|
def enCrypt(key, strings): |
|
|
|
|
# 加密字符串 |
|
|
|
|
try: |
|
|
|
|
import base64 |
|
|
|
|
_key = md5(key).encode('utf-8') |
|
|
|
|
_key = base64.urlsafe_b64encode(_key) |
|
|
|
|
|
|
|
|
|
if type(strings) != bytes: |
|
|
|
|
strings = strings.encode('utf-8') |
|
|
|
|
import cryptography |
|
|
|
|
from cryptography.fernet import Fernet |
|
|
|
|
f = Fernet(key) |
|
|
|
|
f = Fernet(_key) |
|
|
|
|
result = f.encrypt(strings) |
|
|
|
|
return result.decode('utf-8') |
|
|
|
|
except: |
|
|
|
|
# print(get_error_info()) |
|
|
|
|
print(getTracebackInfo()) |
|
|
|
|
return strings |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def deCrypt(key, strings): |
|
|
|
|
# 解密字符串 |
|
|
|
|
try: |
|
|
|
|
import base64 |
|
|
|
|
_key = md5(key).encode('utf-8') |
|
|
|
|
_key = base64.urlsafe_b64encode(_key) |
|
|
|
|
|
|
|
|
|
if type(strings) != bytes: |
|
|
|
|
strings = strings.decode('utf-8') |
|
|
|
|
strings = strings.encode('utf-8') |
|
|
|
|
from cryptography.fernet import Fernet |
|
|
|
|
f = Fernet(key) |
|
|
|
|
f = Fernet(_key) |
|
|
|
|
result = f.decrypt(strings).decode('utf-8') |
|
|
|
|
return result |
|
|
|
|
except: |
|
|
|
|
# print(get_error_info()) |
|
|
|
|
print(getTracebackInfo()) |
|
|
|
|
return strings |
|
|
|
|
|
|
|
|
|
|
|
|
|
|