Skip to content

Invalid request #729

Closed Answered by BTMuli
BTMuli asked this question in Q&A
May 18, 2023 · 2 comments · 4 replies
Discussion options

You must be logged in to vote

md5 计算的时候原始字符串错了。

假使 q 数据为 role_id=500299765&server=cn_qd01, params{salt,t,q,b,r}

原来的写法如下

const md5Str = md5.createHash("md5").update(qs.stringify(params)).digest("hex");

原始加密字符串为 ...&q=role_id%3D500299765%26server%3Dcn_qd01,过不了测试

后面改成手动拼接或者 decode

const md5Str = md5.createHash("md5").update(decodeURIComponent(qs.stringify(params))).digest("hex");

此时的加密字符串为 ...&q=role_id=500299765&server=cn_qd01,验证成功。

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@BTMuli
Comment options

BTMuli May 19, 2023
Maintainer Author

@BTMuli
Comment options

BTMuli May 19, 2023
Maintainer Author

@Lightczx
Comment options

@BTMuli
Comment options

BTMuli May 19, 2023
Maintainer Author

Comment options

BTMuli
May 19, 2023
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by BTMuli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants