🐛 Remove dataview from decryptChunk
This commit is contained in:
parent
c620a9f55e
commit
f0cba0e955
1 changed files with 5 additions and 3 deletions
|
@ -24,7 +24,7 @@ export default function getDecryptor([key0, key1, key2]: [number, number, number
|
||||||
|
|
||||||
return (encryptedChunk: Buffer) => {
|
return (encryptedChunk: Buffer) => {
|
||||||
const decryptedChunk = Buffer.alloc(encryptedChunk.length);
|
const decryptedChunk = Buffer.alloc(encryptedChunk.length);
|
||||||
const dvOut = new DataView(decryptedChunk.buffer);
|
//const dvOut = new DataView(decryptedChunk.buffer);
|
||||||
|
|
||||||
for (let i = 0; i < encryptedChunk.length; i += 1) {
|
for (let i = 0; i < encryptedChunk.length; i += 1) {
|
||||||
//read byte
|
//read byte
|
||||||
|
@ -39,9 +39,11 @@ export default function getDecryptor([key0, key1, key2]: [number, number, number
|
||||||
if (position + i < 12) {
|
if (position + i < 12) {
|
||||||
//do nothing
|
//do nothing
|
||||||
} else if (position + i >= 12 && position < 12) {
|
} else if (position + i >= 12 && position < 12) {
|
||||||
dvOut.setUint8(position + i - 12, curChar);
|
//dvOut.setUint8(position + i - 12, curChar);
|
||||||
|
decryptedChunk.writeUInt8(curChar, position + i - 12);
|
||||||
} else {
|
} else {
|
||||||
dvOut.setUint8(i, curChar);
|
//dvOut.setUint8(i, curChar);
|
||||||
|
decryptedChunk.writeUInt8(curChar, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
//update keys
|
//update keys
|
||||||
|
|
Loading…
Reference in a new issue