-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eeb44f3
commit 7683388
Showing
18 changed files
with
6,873 additions
and
7,046 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"useTabs": true, | ||
"semi": true, | ||
"singleQuote": true, | ||
"printWidth": 120, | ||
"plugins": ["prettier-plugin-svelte"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.html", "*.svelte"], | ||
"options": { | ||
"printWidth": 600 | ||
} | ||
}, | ||
{ | ||
"files": "*.svelte", | ||
"options": { "parser": "svelte" } | ||
} | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,8 @@ | |
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2LwA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous" /> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2LwA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> | ||
%sveltekit.head% | ||
</head> | ||
<body data-sveltekit-preload-data="hover"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,75 @@ | ||
/** | ||
* based off | ||
* https://github.com/mid-kid/pmdrtdx_passwords/blob/master/password.py#L44 | ||
*/ | ||
export class BitstreamReader { | ||
bytes: bigint[]; | ||
bytesize: bigint; | ||
pos: number; | ||
bits: bigint; | ||
value: bigint; | ||
constructor(bytes: number[], bytesize: number) { | ||
this.bytes = []; | ||
for (const byte of bytes) { | ||
this.bytes.push(BigInt(byte)); | ||
} | ||
this.bytesize = BigInt(bytesize); | ||
this.pos = 0; | ||
this.bits = 0n; | ||
this.value = 0n; | ||
} | ||
|
||
remaining(): boolean { | ||
if (this.pos < this.bytes.length) return true; | ||
if (this.bits > 0n) return true; | ||
return false; | ||
} | ||
|
||
read(count: number | bigint): number { | ||
if (typeof count === 'number') count = BigInt(count); | ||
while (this.bits < count) { | ||
if (this.pos >= this.bytes.length) break; | ||
this.value |= (this.bytes[this.pos] & ((1n << this.bytesize) - 1n)) << this.bits; | ||
this.bits += this.bytesize; | ||
this.pos++; | ||
} | ||
const ret = this.value & ((1n << count) - 1n); | ||
this.value >>= count; | ||
this.bits -= count; | ||
return Number(ret); | ||
} | ||
} | ||
|
||
/** | ||
* based off | ||
* https://github.com/mid-kid/pmdrtdx_passwords/blob/master/password.py#L72 | ||
*/ | ||
export class BitstreamWriter { | ||
bytes: number[]; | ||
bytesize: bigint; | ||
bits: bigint; | ||
value: bigint; | ||
constructor(bytesize: number) { | ||
this.bytes = []; | ||
this.bytesize = BigInt(bytesize); | ||
this.bits = 0n; | ||
this.value = 0n; | ||
} | ||
|
||
finish(): number[] { | ||
if (this.bits > 0) this.bytes.push(Number(this.value & ((1n << this.bytesize) - 1n))); | ||
return this.bytes; | ||
} | ||
|
||
write(value: number | bigint, bits: number | bigint): void { | ||
if (typeof value === 'number') value = BigInt(value); | ||
if (typeof bits === 'number') bits = BigInt(bits); | ||
this.value |= (value & ((1n << bits) - 1n)) << this.bits; | ||
this.bits += bits; | ||
while (this.bits >= this.bytesize) { | ||
this.bytes.push(Number(this.value & ((1n << this.bytesize) - 1n))); | ||
this.value >>= this.bytesize; | ||
this.bits -= this.bytesize; | ||
} | ||
} | ||
/** | ||
* based off | ||
* https://github.com/mid-kid/pmdrtdx_passwords/blob/master/password.py#L44 | ||
*/ | ||
export class BitstreamReader { | ||
bytes: bigint[]; | ||
bytesize: bigint; | ||
pos: number; | ||
bits: bigint; | ||
value: bigint; | ||
constructor(bytes: number[], bytesize: number) { | ||
this.bytes = []; | ||
for (const byte of bytes) { | ||
this.bytes.push(BigInt(byte)); | ||
} | ||
this.bytesize = BigInt(bytesize); | ||
this.pos = 0; | ||
this.bits = 0n; | ||
this.value = 0n; | ||
} | ||
|
||
remaining(): boolean { | ||
if (this.pos < this.bytes.length) return true; | ||
if (this.bits > 0n) return true; | ||
return false; | ||
} | ||
|
||
read(count: number | bigint): number { | ||
if (typeof count === 'number') count = BigInt(count); | ||
while (this.bits < count) { | ||
if (this.pos >= this.bytes.length) break; | ||
this.value |= (this.bytes[this.pos] & ((1n << this.bytesize) - 1n)) << this.bits; | ||
this.bits += this.bytesize; | ||
this.pos++; | ||
} | ||
const ret = this.value & ((1n << count) - 1n); | ||
this.value >>= count; | ||
this.bits -= count; | ||
return Number(ret); | ||
} | ||
} | ||
|
||
/** | ||
* based off | ||
* https://github.com/mid-kid/pmdrtdx_passwords/blob/master/password.py#L72 | ||
*/ | ||
export class BitstreamWriter { | ||
bytes: number[]; | ||
bytesize: bigint; | ||
bits: bigint; | ||
value: bigint; | ||
constructor(bytesize: number) { | ||
this.bytes = []; | ||
this.bytesize = BigInt(bytesize); | ||
this.bits = 0n; | ||
this.value = 0n; | ||
} | ||
|
||
finish(): number[] { | ||
if (this.bits > 0) this.bytes.push(Number(this.value & ((1n << this.bytesize) - 1n))); | ||
return this.bytes; | ||
} | ||
|
||
write(value: number | bigint, bits: number | bigint): void { | ||
if (typeof value === 'number') value = BigInt(value); | ||
if (typeof bits === 'number') bits = BigInt(bits); | ||
this.value |= (value & ((1n << bits) - 1n)) << this.bits; | ||
this.bits += bits; | ||
while (this.bits >= this.bytesize) { | ||
this.bytes.push(Number(this.value & ((1n << this.bytesize) - 1n))); | ||
this.value >>= this.bytesize; | ||
this.bits -= this.bytesize; | ||
} | ||
} | ||
} |
Oops, something went wrong.