MCPcopy Create free account
hub / github.com/Semporia/Scripts / decrypt

Function decrypt

tools/jd_dreamFactory_product.js:97–123  ·  view source on GitHub ↗
(time, stk, type, url)

Source from the content-addressed store, hash-verified

95}
96
97function decrypt(time, stk, type, url) {
98 stk = stk || (url ? getUrlData(url, '_stk') : '')
99 if (stk) {
100 const timestamp = new Date(time).Format("yyyyMMddhhmmssSSS");
101 let hash1 = '';
102 if ($.fingerprint && $.token && $.enCryptMethodJD) {
103 hash1 = $.enCryptMethodJD($.token, $.fingerprint.toString(), timestamp.toString(), $.appId.toString(), $.CryptoJS).toString($.CryptoJS.enc.Hex);
104 } else {
105 const random = '5gkjB6SpmC9s';
106 $.token = `tk01wcdf61cb3a8nYUtHcmhSUFFCfddDPRvKvYaMjHkxo6Aj7dhzO+GXGFa9nPXfcgT+mULoF1b1YIS1ghvSlbwhE0Xc`;
107 $.fingerprint = 5287160221454703;
108 const str = `${$.token}${$.fingerprint}${timestamp}${$.appId}${random}`;
109 hash1 = $.CryptoJS.SHA512(str, $.token).toString($.CryptoJS.enc.Hex);
110 }
111 let st = '';
112 stk.split(',').map((item, index) => {
113 st += `${item}:${getUrlData(url, item)}${index === stk.split(',').length - 1 ? '' : '&'}`;
114 })
115 const hash2 = $.CryptoJS.HmacSHA256(st, hash1.toString()).toString($.CryptoJS.enc.Hex);
116 // console.log(`\nst:${st}`)
117 // console.log(`h5st:${["".concat(timestamp.toString()), "".concat($.fingerprint.toString()), "".concat($.appId.toString()), "".concat($.token), "".concat(hash2)].join(";")}\n`)
118 return encodeURIComponent(["".concat(timestamp.toString()), "".concat($.fingerprint.toString()), "".concat($.appId.toString()), "".concat($.token), "".concat(hash2)].join(";"))
119 } else {
120 console.log('use default token')
121 return '20210318144213808;8277529360925161;10001;tk01w952a1b73a8nU0luMGtBanZTHCgj0KFVwDa4n5pJ95T/5bxO/m54p4MtgVEwKNev1u/BUjrpWAUMZPW0Kz2RWP8v;86054c036fe3bf0991bd9a9da1a8d44dd130c6508602215e50bb1e385326779d'
122 }
123}
124
125async function requestAlgo() {
126 $.fingerprint = await generateFp();

Callers 1

mainFunction · 0.70

Calls 2

getUrlDataFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected