HexaRot

Visual cipher that adds geometric rotations to an existing colour alphabet, with a short, reusable key.

Latest change: French interface with a language switcher

Recruiter view

HexaRot encode screen: the message, the rotation parameters, the colour cryptogram and the generated key
See the screenshot at full size
Problem
Hexahue is a simple visual alphabet, where each letter becomes a small block of six coloured cells. Once the alphabet is known, a message can be read by eye. The idea behind HexaRot is to add a layer to this existing system to make it much harder to break.
What was built
A web application and a REST API. The text is written as Hexahue symbols on a grid, completed at random, then the grid is cut into blocks that turn according to a rotation sequence. Rotations move cells one by one, not whole symbols, which breaks letters apart into visual noise. All parameters fit in a short key, reusable for any message. The output is a PNG or SVG image.
Result
Encryption, the key, decryption, the interface and authentication are in place. The strength gain is still to be evaluated; a correlation score, which measures how much of the message's structure survives the rotations, is the first measuring tool.
Skills
TypeScript / NestJS, Vue.js, Cryptography, Application security
Stack
TypeScript, NestJS, PostgreSQL, Prisma, Vue 3, Sharp, Docker

Lead dev view

HexaRot starts from an alphabet I came across in geocaching, Hexahue, which encodes each letter in colours. What interested me was not the alphabet itself, but a question: what do you gain by adding a well-chosen layer to a simple cipher that already exists?

Architecture

HexaRot architecture: transliterated text, grid of Hexahue symbols completed at random, block rotations, PNG or SVG cryptogram; the parameters are packed into a base36 key used for decryption

The NestJS backend splits encryption into modules: visual alphabet, grid construction, rotation engine, key codec, reading orders, PNG and SVG renderers, parameter validation. The text is uppercased and its accents transliterated; a character outside the alphabet is reported to the user rather than silently dropped. The grid is cut into square blocks, each turned according to a sequence picked among 24 permutations, in one direction and following one of eight reading orders. The key packs all these parameters into a short base36 string. The Vue 3 frontend offers encryption, decryption and key generation; PostgreSQL, through Prisma, stores the alphabet definition and the user accounts.

Key decisions

A difficulty

To know where the message ends in the randomly completed grid, I first built a header storing its length, meant to be drawn above the cryptogram. I dropped it before writing the renderers: it gave an attacker information about the plaintext they would not otherwise have, the opposite of what a cipher is for.

That left decryption: without a length, where to stop? The first option was to cut at the first unrecognized symbol, since random padding mostly forms blocks that match no letter. Mostly, but not always: padding can form a real letter by chance, and the cut would then land in the wrong place, with no way for anyone to notice.

I chose to decode everything, without guessing. The message comes out intact, followed by the padding, mostly shown as question marks. It is not the neatest result on screen, but it is the most honest: no heuristic truncates real content or appends noise without saying so. The decision and its limits are recorded in an ADR.

Quality

The backend is tested with Jest, with unit tests and end-to-end API tests, the frontend with Vitest, and everything runs on every change in a GitHub Actions CI, with coverage tracked separately per part on Codecov; the README badges give the current figures. TypeScript runs in strict mode on both sides. A design and usability review led to a series of fixes: the key removed from URLs and downloaded file names, stale results flagged rather than deleted, contrast and keyboard navigation. Production deploys only go out after a successful CI run. Decisions are recorded in ADRs.

Timeline

What I would do differently

I would run a security risk assessment before each roadmap step. The length header was built before I weighed what it revealed, and the key went through a URL until a review caught it. One question asked at each step, "what does this format, algorithm or route leak?", would have brought these points up before writing the code, rather than after.

Architecture decisions (ADR)