changed hex decrypting to match deezer's shit

prob doesn't matter anyways, but just in case
This commit is contained in:
uh wot 2021-07-15 19:19:00 +02:00
parent de585b2ff8
commit ebfed57c9d
Signed by: uhwot
GPG Key ID: CB2454984587B781
1 changed files with 6 additions and 2 deletions

View File

@ -3,7 +3,7 @@
// @namespace io.github.uhwot.dzunlock // @namespace io.github.uhwot.dzunlock
// @description enables deezer hifi features lol // @description enables deezer hifi features lol
// @author uh wot // @author uh wot
// @version 1.1.5 // @version 1.1.6
// @license GPL-3.0-only // @license GPL-3.0-only
// @homepageURL https://git.freezer.life/uhwot/dzunlock // @homepageURL https://git.freezer.life/uhwot/dzunlock
// @downloadURL https://git.freezer.life/uhwot/dzunlock/raw/branch/master/dzunlock.user.js // @downloadURL https://git.freezer.life/uhwot/dzunlock/raw/branch/master/dzunlock.user.js
@ -100,10 +100,14 @@ function str2bin(str) {
}) })
} }
function bin2str(bin) {
return String.fromCharCode.apply(String, bin);
}
function decryptHex(hex, key) { function decryptHex(hex, key) {
hex = aesjs.utils.hex.toBytes(hex) hex = aesjs.utils.hex.toBytes(hex)
let aesEcb = new aesjs.ModeOfOperation.ecb(key) let aesEcb = new aesjs.ModeOfOperation.ecb(key)
return aesjs.utils.utf8.fromBytes(aesEcb.decrypt(hex)).replace(/\0+$/, '') // removes zero-padding return bin2str(aesEcb.decrypt(hex)).replace(/\0+$/, '') // removes zero-padding
} }
function encryptHex(str, key) { function encryptHex(str, key) {