fix lint error

This commit is contained in:
GEEKiDoS
2024-01-08 20:57:56 +08:00
parent e14f16c4d9
commit a9c444b1d1
18 changed files with 154 additions and 112 deletions
+3 -6
View File
@@ -10,21 +10,18 @@ export function lz77Decode(data: Buffer): Buffer {
if (flag & (1 << bit)) {
output.push(data[offset]);
offset += 1;
} else {
if (offset >= data.length)
break;
if (offset >= data.length) break;
const lookbackFlag = data.readUInt16BE(offset);
const lookbackLength = (lookbackFlag & 0x000f) + 3;
const lookbackOffset = lookbackFlag >> 4;
offset += 2;
if (lookbackFlag == 0)
break;
if (lookbackFlag == 0) break;
for (let i = 0; i < lookbackLength; i++) {
let loffset = output.length - lookbackOffset;
const loffset = output.length - lookbackOffset;
if (loffset <= 0 || loffset >= output.length) {
output.push(0);
+5 -6
View File
@@ -1,13 +1,12 @@
import { createHash } from "crypto";
import { createHash } from 'crypto';
import rc4 from 'arc4';
const EAMUSE_RC4_KEY = '69D74627D985EE2187161570D08D93B12455035B6DF0D8205DF5';
export function rc4Transfrom(keyHex: string, data: Buffer) {
export function rc4Transfrom(keyHex: string, data: Buffer): Buffer {
const key = createHash('md5')
.update(keyHex + EAMUSE_RC4_KEY, 'hex')
.digest();
.update(keyHex + EAMUSE_RC4_KEY, 'hex')
.digest();
return rc4('arc4', key)
.encodeBuffer(data)
return rc4('arc4', key).encodeBuffer(data);
}