From a06f38a437d5e3380db0bcdbb15660fe114f17eb Mon Sep 17 00:00:00 2001 From: Yuki1536 <69851694+Yuki1536@users.noreply.github.com> Date: Mon, 5 Dec 2022 10:26:41 +0900 Subject: [PATCH] fix(kwm): allow new magic header --- src/decrypt/kwm.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/decrypt/kwm.ts b/src/decrypt/kwm.ts index a72b202..32d4936 100644 --- a/src/decrypt/kwm.ts +++ b/src/decrypt/kwm.ts @@ -13,14 +13,18 @@ import { DecryptResult } from '@/decrypt/entity'; //prettier-ignore const MagicHeader = [ - 0x79, 0x65, 0x65, 0x6C, 0x69, 0x6F, 0x6E, 0x2D, - 0x6B, 0x75, 0x77, 0x6F, 0x2D, 0x74, 0x6D, 0x65, -] + 0x79, 0x65, 0x65, 0x6C, 0x69, 0x6F, 0x6E, 0x2D, + 0x6B, 0x75, 0x77, 0x6F, 0x2D, 0x74, 0x6D, 0x65, +]; +const MagicHeader2 = [ + 0x79, 0x65, 0x65, 0x6C, 0x69, 0x6F, 0x6E, 0x2D, + 0x6B, 0x75, 0x77, 0x6F, 0x00, 0x00, 0x00, 0x00, +]; const PreDefinedKey = 'MoOtOiTvINGwd2E6n0E1i7L5t2IoOoNk'; export async function Decrypt(file: File, raw_filename: string, _: string): Promise { const oriData = new Uint8Array(await GetArrayBuffer(file)); - if (!BytesHasPrefix(oriData, MagicHeader)) { + if (!BytesHasPrefix(oriData, MagicHeader) && !BytesHasPrefix(oriData, MagicHeader2)) { if (SniffAudioExt(oriData) === 'aac') { return await RawDecrypt(file, raw_filename, 'aac', false); }