赞
踩
import uuid import base64 def get_mac_address(): """ 获取mac地址 """ mac = uuid.UUID(int = uuid.getnode()).hex[-12:] mac = ":".join([mac[e:e+2] for e in range(0,11,2)]) return mac def decode_base64(content): """ 解码 """ result = base64.b64decode(content) return result.decode() def encode_base64(contents): """ 编码 """ result = base64.b64encode(contents.encode()) return str(result,'utf-8') def public_key(): """ mac 地址加密值 """ mac = get_mac_address() encryption = encode_base64(mac) return encryption if __name__ == '__main__': # mac = get_mac_address() # print(f"mac 地址为 :{mac}") encryption = encode_base64("70:b5:e8:38:f0:95") print(f"加密后: {encryption}") # print(mac==decrypt)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。