Commit 5016df98 authored by xiao-hesheng's avatar xiao-hesheng
Browse files

添加加密类,类函数已经验证加密内容是否正确

parent dacddc0c
...@@ -34,19 +34,20 @@ class PasswordEncrypt(object): ...@@ -34,19 +34,20 @@ class PasswordEncrypt(object):
# print("en_text:", en_text) # print("en_text:", en_text)
# print("base64 de_text2:", en_text.hex()) # print("base64 de_text2:", en_text.hex())
# print('en_text',en_text)
return en_text.hex() return en_text.hex()
def pad(slef, text): def pad(slef, text):
print(type(text)) # print(type(text))
text_length = len(text) text_length = len(text)
amount_to_pad = AES.block_size - (text_length % AES.block_size) amount_to_pad = AES.block_size - (text_length % AES.block_size)
print('amount_to_pad',amount_to_pad) # print('amount_to_pad',amount_to_pad)
print(type(amount_to_pad)) # print(type(amount_to_pad))
if amount_to_pad == 0: if amount_to_pad == 0:
amount_to_pad = AES.block_size amount_to_pad = AES.block_size
pad = chr(amount_to_pad) pad = chr(amount_to_pad)
print('pad',pad) # print('pad',pad)
print(text+pad * amount_to_pad) # print(text+pad * amount_to_pad)
return text + pad * amount_to_pad return text + pad * amount_to_pad
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment