-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcryto.js
40 lines (30 loc) · 1.14 KB
/
cryto.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const crypto = require("crypto");
const md2 = require("js-md2");
const activityId = "activityId=947079313798000641";
const storeId = "storeId=49006";
const timestamp = "×tamp=1728612892528";
const appid = "appid=wxafec6f8422cb357b";
const secretKey = "&xiaoMan5&Qimai6*Bwcj8_3DI1^xX0";
const token =
"Qm-User-Token=FZqzj837jbtKRZhmckAI7LChE3fX01avnVC16RO3QMscDx6fjwmrw73v_7sev6AM";
// Concatenate the values
const data = appid + timestamp + secretKey;
const beta = activityId + timestamp + secretKey;
console.log("Data:", data);
// Hash the concatenated data using MD5
const md5Hash = crypto.createHash("md5").update(data).digest("hex");
console.log("MD5 Hash:", md5Hash);
const hmacMd5 = crypto.createHmac("md5", secretKey).update(beta).digest("hex");
console.log("HMAC-MD5:", hmacMd5);
const hmacSha1 = crypto
.createHmac("sha1", secretKey)
.update(data)
.digest("hex");
console.log("HMAC-SHA1:", hmacSha1);
const hash = crypto.createHash("sha1").update(data).digest("hex");
console.log("SHA1:", hash);
function E(M) {
return m.Z.post("/catering/common/ali-verify-code", { mobile: M });
}
const md2Hash = md2(data);
console.log(md2Hash);