mirror of
https://github.com/laochan-eacnet/backend.git
synced 2026-10-10 23:38:09 +03:00
fix lint error
This commit is contained in:
+3
-6
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user