The code is for learning and communication only , Do not use for illegal purposes
import execjs
js = '''
function p(e, t) {
var a = (65535 & e) + (65535 & t), n = (e >> 16) + (t >> 16) + (a >> 16);
return n << 16 | 65535 & a;
}
function I(e, t) {
return j(N(e, t));
}
function w(e, t, a) {
return t ? a ? N(t, e) : I(t, e) : a ? C(e) : S(e);
}
function P() {
return (65536 * (1 + Math.random()) | 0).toString(16).substring(1);
}
function T() {
return [ P() + P(), P(), P(), P(), P() + P() + P() + P() ].join("-");
}
var L = {
md5: w,
genGuid: T
}
function sign(a){
let n, r = getSignString(a);
let signStr = r
return signStr;
}
'''
ctx = execjs.compile(js)
def getSign(data):
'''
Signature method
:param data: Signature parameter ( Dictionaries )
:return:
'''
signStr = ctx.call("sign", data)
return signStr
if __name__ == '__main__':
# Signature parameter
data = {
"longitude": 106.56641, "latitude": 24.85152, "buid": 325, "time": 1621413926788}
data = {
"buid": 325, "time": 1621416028888}
print(getSign(data))