mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
Stream.readBits() method implemented. Unfinished.
This commit is contained in:
parent
2a6db47aeb
commit
c077b22410
2 changed files with 8 additions and 11 deletions
|
@ -1438,10 +1438,8 @@ export function extractGZIP(bytes, offset) {
|
|||
|
||||
while (!finalBlock) {
|
||||
// Read header
|
||||
const blockHeader = stream.readBits(3);
|
||||
|
||||
finalBlock = blockHeader & 0x1;
|
||||
const blockType = blockHeader & 0x6;
|
||||
finalBlock = stream.readBits(1);
|
||||
const blockType = stream.readBits(2);
|
||||
|
||||
if (blockType === 0) {
|
||||
// No compression
|
||||
|
@ -1451,23 +1449,23 @@ export function extractGZIP(bytes, offset) {
|
|||
stream.moveForwardsBy(2 + blockLength);
|
||||
} else if (blockType === 1) {
|
||||
// Fixed Huffman
|
||||
console.log("Fixed Huffman");
|
||||
|
||||
} else if (blockType === 2) {
|
||||
// Dynamic Huffman
|
||||
|
||||
console.log("Dynamic Huffman");
|
||||
} else {
|
||||
throw new Error("Invalid block type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* FOOTER */
|
||||
|
||||
// Skip over checksum and size of original uncompressed input
|
||||
stream.moveForwardsBy(8);
|
||||
|
||||
console.log(stream.position);
|
||||
console.log("Ending at " + stream.position);
|
||||
|
||||
return stream.carve();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue