← Back to Blog

ADFGVX Project — What This Code Can Become

Five rounds. An encoder and a decoder. Two keys, two layers, one cipher that held the Western Front for three months in 1918.

Take a moment with that.

What you built works. But it's a starting point, not a finish line. Here's where it can go — and where the same logic applies elsewhere.

How far this can go

A single program. Right now encoder and decoder are separate files. A menu — encode or decode — brings them together. One program, two modes, the same keys shared between them. You have everything you need to build it.

Key exchange. The biggest vulnerability in any symmetric cipher is key distribution — how do you share the keys securely? You could encrypt the keys themselves with a simpler cipher before sending. You could generate them from a shared passphrase using a deterministic algorithm. Both are buildable with what you know.

Validation on the decoder side. Right now the decoder produces WENEEDCOFFEEASAP when something goes wrong. A more sophisticated approach: validate that the decoded message contains only characters from all_chars. If it doesn't — the keys were wrong. Silent, informative, no error messages for the wrong person.

Multiple messages. A loop around the encoder lets you encode several messages in one session, each exported to a dated file. The decoder already loads by date — they pair naturally.

Where the same logic applies

Substitution and transposition aren't ADFGVX-specific. They're the two fundamental operations of classical cryptography. The same structure — replace, then scramble — appears in:

Vigenère cipher. Substitution only, but key-dependent. Each letter shifts by a different amount based on a repeating keyword. Buildable with what you know — a dict, a loop, a key that cycles.

Rail fence cipher. Transposition only. Characters distributed across rows in a zigzag pattern, then read row by row. The logic is close to what you already wrote for ADFGVX transposition.

One-time pad. The theoretically unbreakable cipher — substitution with a key as long as the message, used only once. Simple in concept, complex in key management. The encoding logic is straightforward.

The principles behind these — and behind every modern encryption algorithm — are the same ones you implemented here. AES, RSA, elliptic curve cryptography — all of them are substitution and transposition at a scale and mathematical depth that goes far beyond this course. But the conceptual foundation is identical.

Painvin broke ADFGVX with paper, pencil, and pattern recognition. Modern ciphers are designed to resist computers running for centuries. The distance between here and there is real. But you're standing on the right side of the line now.

You understand what encryption is. Not as a concept — as code you wrote yourself.

[ login to bookmark ] // copied! 34 views · 2 min
← prev ADFGVX Project — Round 5/5 next → The Beginning of Infinite
// 0 comments
// No comments yet. Be the first.
// leave a comment

// Your comment will appear after approval.