标签:node return blog strip alt 代码 name uuid []
自用加盐代码,请无视。
代码如下:
# coding:utf-8 import uuid from functools import reduce def salt(num): if num<33333: num = 3*(num+3) num = salt(num) return num def encrypt(_str,password): keys = [] for char in _str: if char.isalpha(): key = ord(char)-96 else: key = salt(ord(char)) keys.append(str(key)) return password.join(keys) def dec_mac(get_mac_address): def wrapper(password): password = str(password) return str(reduce(lambda x, y: x*y,[int(one)*3 for one in encrypt(password,password).join(encrypt(get_mac_address(),password)) if int(one)!=0])).strip("0") return wrapper @dec_mac def get_mac_address(): mac=uuid.UUID(int = uuid.getnode()).hex[-12:] ret = ":".join([mac[e:e+2] for e in range(0,11,2)]) return ret.lower() if __name__ == ‘__main__‘: key = "kdfhb234kus3" salt_mac = get_mac_address(encrypt(key,"3")) with open("cipher","w") as cipher: cipher.write(salt_mac)
没事儿多想想也是好事儿。
标签:node return blog strip alt 代码 name uuid []
原文地址:http://www.cnblogs.com/LanTianYou/p/6954107.html