Fix all lint errors

This commit is contained in:
2024-03-15 11:24:39 -05:00
parent af443bff96
commit fae92715b5
3 changed files with 24 additions and 4210 deletions

4196
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -11,7 +11,7 @@ export const flags = {
CF_BLOCKED: 'cf-blocked', CF_BLOCKED: 'cf-blocked',
} as const; } as const;
export type Flags = typeof flags[keyof typeof flags]; export type Flags = (typeof flags)[keyof typeof flags];
export const targets = { export const targets = {
// browser with CORS restrictions // browser with CORS restrictions
@@ -27,7 +27,7 @@ export const targets = {
ANY: 'any', ANY: 'any',
} as const; } as const;
export type Targets = typeof targets[keyof typeof targets]; export type Targets = (typeof targets)[keyof typeof targets];
export type FeatureMap = { export type FeatureMap = {
requires: Flags[]; requires: Flags[];

View File

@@ -141,7 +141,7 @@ class Blowfish {
this.generateSubkeys(t); this.generateSubkeys(t);
} }
encrypt(e: string): string { encrypt(e: string) {
const root = this.utf8Decode(e); const root = this.utf8Decode(e);
let encrypted = ''; let encrypted = '';
const blockSize = 8; const blockSize = 8;
@@ -164,7 +164,7 @@ class Blowfish {
return encrypted; return encrypted;
} }
decrypt(input: string): string { decrypt(input: string) {
const numBlocks = Math.ceil(input.length / 8); const numBlocks = Math.ceil(input.length / 8);
let decrypted = ''; let decrypted = '';
for (let i = 0; i < numBlocks; i++) { for (let i = 0; i < numBlocks; i++) {
@@ -179,7 +179,7 @@ class Blowfish {
return this.utf8Encode(decrypted); return this.utf8Encode(decrypted);
} }
substitute(value: number): number { substitute(value: number) {
const t = value >>> 24; const t = value >>> 24;
const n = (value << 8) >>> 24; const n = (value << 8) >>> 24;
const r = (value << 16) >>> 24; const r = (value << 16) >>> 24;
@@ -190,13 +190,23 @@ class Blowfish {
return result; return result;
} }
encipher(e, t) { /* eslint-disable */
for (var n, r = 0; r < 16; r++) encipher(plaintext: number, key: number) {
(n = e = this.xor(e, this.pArray[r])), (e = t = this.xor(this.substitute(e), t)), (t = n); for (var temp, round = 0; round < 16; round++) {
return (n = e), (e = t), (t = n), (t = this.xor(t, this.pArray[16])), [(e = this.xor(e, this.pArray[17])), t]; temp = plaintext = this.xor(plaintext, this.pArray[round]);
plaintext = key = this.xor(this.substitute(plaintext), key);
key = temp;
} }
temp = plaintext;
plaintext = key;
key = temp;
key = this.xor(key, this.pArray[16]);
decipher(left: number, right: number): [number, number] { return [(plaintext = this.xor(plaintext, this.pArray[17])), key];
}
/* eslint-enable */
decipher(left: number, right: number) {
let n; let n;
let e = left; let e = left;
let t = right; let t = right;
@@ -287,7 +297,7 @@ class Blowfish {
return [this.block32toNum(t), this.block32toNum(n)]; return [this.block32toNum(t), this.block32toNum(n)];
} }
utf8Decode(input: string): string { utf8Decode(input: string) {
let decoded = ''; let decoded = '';
for (let i = 0; i < input.length; i++) { for (let i = 0; i < input.length; i++) {
const charCode = input.charCodeAt(i); const charCode = input.charCodeAt(i);
@@ -307,7 +317,7 @@ class Blowfish {
return decoded; return decoded;
} }
utf8Encode(input: string): string { utf8Encode(input: string) {
let encoded = ''; let encoded = '';
let charCode; let charCode;
for (let i = 0; i < input.length; i++) { for (let i = 0; i < input.length; i++) {
@@ -328,7 +338,7 @@ class Blowfish {
return encoded; return encoded;
} }
bd(e: string): string { bd(e: string) {
let t; let t;
let n; let n;
let r; let r;