某手app的__NS_sig3,sig,__NStokensig算法

快手app的__NS_sig3,sig,__NStokensig算法

def gen_tokensig(sig,salt=""):
    v = sig + salt
    return hashlib.sha256(v.encode('utf-8')).hexdigest()

def gen_sig(params,data):
    dd = dict(params,**data)
    dict_sort_res = dict(sorted(dd.items(),key=lambda x:x[0]))
    ss = ""
    for key,value in dict_sort_res.items():
        if key not in ["sig","__NS_sig3","sig2"]:
            ss += f"{key}={value}"
    ss += "ca8e86efb32e"
    return hashlib.md5(ss.encode()).hexdigest()

可以加 zp953362984

你可能感兴趣的:(python)