Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

签名算法 #4

Open
lzghzr opened this issue Jul 25, 2021 · 2 comments
Open

签名算法 #4

lzghzr opened this issue Jul 25, 2021 · 2 comments

Comments

@lzghzr
Copy link

lzghzr commented Jul 25, 2021

传入参数

t = '{"id":"[1,34,1,23058]","device":"[\"c4ca4238a0b923820dcc509a6f75849b\",\"55e2620e-a2b9-4086-bd9a-bc399ba13480\"]","ets":1570562610,"benchmark":"seacasdgyijfhofiuxoannn","time":120,"ts":1570562730734}'

格式化为

t_fmt = '{"platform":"web","parent_id":1,"area_id":34,"seq_id":1,"room_id":23058,"buvid":"c4ca4238a0b923820dcc509a6f75849b","uuid":"55e2620e-a2b9-4086-bd9a-bc399ba13480","ets":1570562610,"time":120,"ts":1570562730734}'
benchmark = 'seacasdgyijfhofiuxoannn'

接着依据r计算HMAC

0 HMAC-MD5
1 HMAC-SHA1
2 HMAC-SHA256
3 HMAC-SHA224
4 HMAC-SHA512
5 HMAC-SHA384

r = [2, 5, 1, 4]

sign = Hmac('SHA512', Hmac('SHA1', Hmac('SHA384', Hmac('SHA256', t_fmt, benchmark), benchmark), benchmark), benchmark)
// e8cbbdad5fe85ef881bf6cab1dc5d767c53f574ce92c0cd39513b2941e1d3344cd88eeb4eda19b7c3a00f368774e653bd476425355c6d5c818b2b0795dd5adb7
@yanran1314
Copy link

您好,请问下这个“device”中的[“buvid”,"uuid"],这两个参数咋通过cookie获取呢?

@lzghzr
Copy link
Author

lzghzr commented Feb 23, 2023

您好,请问下这个“device”中的[“buvid”,"uuid"],这两个参数咋通过cookie获取呢?

不是在cookie里就是在localstorage里,很好找

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants