kg通用签名函数

by @helloplhm-qwq
This commit is contained in:
Folltoshe 2023-03-16 23:53:47 +08:00 committed by GitHub
parent 37ad2f522a
commit e096f89108
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,5 @@
import { inflate } from 'zlib' import { inflate } from 'zlib'
import { toMD5 } from '../utils'
// https://github.com/lyswhut/lx-music-desktop/issues/296#issuecomment-683285784 // https://github.com/lyswhut/lx-music-desktop/issues/296#issuecomment-683285784
const enc_key = Buffer.from([0x40, 0x47, 0x61, 0x77, 0x5e, 0x32, 0x74, 0x47, 0x51, 0x36, 0x31, 0x2d, 0xce, 0xd2, 0x6e, 0x69], 'binary') const enc_key = Buffer.from([0x40, 0x47, 0x61, 0x77, 0x5e, 0x32, 0x74, 0x47, 0x51, 0x36, 0x31, 0x2d, 0xce, 0xd2, 0x6e, 0x69], 'binary')
@ -14,6 +15,14 @@ export const decodeLyric = str => new Promise((resolve, reject) => {
}) })
}) })
// 通用签名函数
export const signature = (params) => {
let param_list = params.split('&')
param_list.sort()
let sign_params = `OIlwieks28dk2k092lksi2UIkp${param_list.join('')}OIlwieks28dk2k092lksi2UIkp`
return toMD5(sign_params)
}
// s.content[0].lyricContent.forEach(([str]) => { // s.content[0].lyricContent.forEach(([str]) => {
// console.log(str) // console.log(str)
// }) // })