Skip to content

Add gnaw: a Rust stack language with built-in CTF byte transforms - #2

Open
warlyjr-cloud wants to merge 1 commit into
fakedrake:mainfrom
warlyjr-cloud:add-gnaw
Open

Add gnaw: a Rust stack language with built-in CTF byte transforms#2
warlyjr-cloud wants to merge 1 commit into
fakedrake:mainfrom
warlyjr-cloud:add-gnaw

Conversation

@warlyjr-cloud

Copy link
Copy Markdown

Hi! Adding gnaw — I think it fits the same slot as Kitten and Stabel on the list: it borrows Forth's model without claiming to be one.

What it is: a small concatenative language in Rust. Whitespace-separated words, a data stack, : name ... ; definitions, a separate return stack (>r r> r@), if/else/then, begin/until, counted do/loop with i, and a see disassembler that dumps a word's compiled bytecode. Lexer → single-pass compiler (jumps resolved with a stack of pending back-patches, no AST) → bytecode VM with a program counter.

What it is not: ANS-compliant. No IMMEDIATE/POSTPONE, no CREATE/DOES>, no vocabularies. I've tried to say that plainly in the README so nobody arrives expecting a standards Forth.

Its actual angle: built-in words for the byte transforms that come up constantly in CTF and reverse-engineering work — hex>bytes/bytes>hex, xorkey (repeating key), rot13, b64encode/b64decode, and brute (all 256 single-byte XOR keys, filtered by a natural-language heuristic). They all share an ( addr len -- addr len ) shape, so they compose, and slurp reads a real file into that same shape. Decoding a challenge ends up as one line:

"051807040f010d15113c1d153c150a0a02031e" hex>bytes "ctf" xorkey type cr
→ flag{gnaw_is_alive}

There's a browser playground (WebAssembly, runs locally) if you'd rather poke at it than clone it.

Totally understand if it's out of scope for the list — thanks either way for maintaining it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant