跳到主要内容

Cipher tool fixes: corrected worked examples and one-click samples

· 阅读需 3 分钟
工具坞
工具坞团队

The cipher tools are the most-visited corner of Gongju.dev, and an audit of the two busiest pages turned up two documentation errors worth fixing, plus a usability gap that was costing us every visitor who landed on them.

Two wrong examples​

Rail Fence. The worked example labelled its plaintext HELLO WORLD and showed the ciphertext HOLELWRDLO. Those two cannot both be right: the tool encrypts spaces like any other character, and HELLO WORLD on three rails actually produces HOREL OLLWD. The grid and the ciphertext were correct — they had been computed for HELLOWORLD with no space — so the label was the odd one out. The example now uses HELLOWORLD consistently, and we added a second line showing the spaced variant so the space-handling behaviour is documented rather than surprising. Fixed in both the Chinese and English pages.

Bacon cipher. The lookup table listed Y as BAAAA and Z as BAAAB — duplicates of Q and R. The correct 5-bit encodings are BBAAA and BBAAB. All 26 rows now match what the tool actually produces.

One-click samples on all eight cipher tools​

Every cipher tool opened with an empty text box, so a visitor arriving from search had no idea what to type. The numbers matched the suspicion: over the seven days from 22 to 28 September the site served 702 pageviews across 562 sessions, but 507 of those sessions — 90% — never opened a second page. The cipher pages alone accounted for 302 of those 702 pageviews, and the Atbash page was the clearest case, with essentially every session that started there also ending there.

All eight cipher tools — Atbash, Rail Fence, Caesar, ROT13, Bacon, Morse, Vigenère, and Pigpen — now have a Fill example button next to Clear. One click loads a sample and runs the conversion, so the tool demonstrates itself immediately:

ToolSampleResult
AtbashHELLOSVOOL
Rail FenceHELLOWORLD (3 rails)HOLELWRDLO
CaesarHELLO WORLD (shift 3)KHOOR ZRUOG
ROT13HELLOURYYB
BaconHIAABBB ABAAA
MorseSOS... --- ...
VigenèreHELLO + key KEYRIJVS
PigpenMASONrendered glyph grid

Where a tool's page already showed a worked example, the sample was chosen to reproduce it exactly, so the documentation and the running tool cannot quietly drift apart again — there is now a unit test asserting each pair. (Pigpen's page has no worked example to match.) The Rail Fence and Caesar samples respect whatever rail count or shift you have already dialled in rather than resetting it.

The button labels are translated across all four site languages, and the button rows now wrap on narrow screens so they no longer squeeze each other on phones.