Why messages become numbers
Public-key systems do arithmetic, so a message has to become a number before it can be encrypted, and the number that comes out of decryption has to be turned back into words or coordinates. That last step catches out a lot of solvers: the math can be perfect and the answer still look like noise, just because it's being read the wrong way.
The puzzle should say how its message was encoded. This page shows the usual ways, and how to spot them.
Four common encodings
Letter positions (A = 1 … Z = 26)
Each letter is its place in the alphabet, written with 2 digits so they can be strung together. HELLO is 08 05 12 12 15, or 0805121215.
Character codes (ASCII and Unicode)
Computers number every character. The first 128 numbers are ASCII; the useful part is below. Written in decimal with 3 digits each, HI is 072 073, or 072073.
| Characters | Codes |
|---|---|
| space | 32 |
| digits 0 to 9 | 48 to 57 |
| capitals A to Z | 65 to 90 |
| small a to z | 97 to 122 |
| accented Latin letters, such as é (233) and ß (223) | 160 to 255 |
| other alphabets, such as Greek Ω (937) and Cyrillic М (1052) | above 255, so they need 4-digit blocks |
Codes above 127 come from Unicode, which extends ASCII to every writing system. A message in another alphabet usually uses 4-digit blocks.
Hexadecimal bytes
Real software stores each character as a byte, two hexadecimal (base-16) digits, and reads the whole string as one base-16 number. HI is the bytes 48 49 in hex, the number 0x4849, which is 18505 in decimal. To read it back, write the number in hex and split it into pairs.
Digits as they are
Coordinates are often written straight in as digits. N 45° 12.345 W 093° 54.321 becomes 451234509354321: 2 digits of degrees and 5 of minutes for the latitude, then 3 + 5 for the longitude, 15 digits in all. Some puzzles write the longitude's degrees with 2 digits (93 instead of 093), giving 14. The hemispheres (N or S, E or W) are left for you to fill in from where the cache is.
Packing a message into one number
With fixed-width blocks, the codes are simply written one after another to make one long number. That only works if every block has the same width, which is why A = 1 becomes 01 and H = 72 becomes 072.
The number has to be smaller than the modulus it's encrypted under, so a 45-digit key carries at most about 14 characters in 3-digit blocks. Longer messages are split into several numbers, each encrypted on its own.
A puzzle can also mix kinds: coordinates as plain digits, followed by a short message in character codes, all packed into the same number.
The lost leading zero
A number can't start with 0, so if the first block does, that zero quietly disappears. “OK” in 3-digit codes is 079 075, but as a number it's 79075, only 5 digits.
When the digit count isn't a multiple of the block size, put zeros back on the front until it is: 79075 has 5 digits, so add one, giving 079075, and the blocks line up again. The worksheets' readers do this for you with “Put back a missing leading zero”.
Where the blocks start
If a message follows some coordinates, the blocks don't start at the beginning of the number. Take 15 digits of coordinates followed by “OK”:
Reading the whole thing in 3-digit blocks from the start gives 451 234 509 …, which is nonsense. Skip the first 15 digits and it reads O K. Lining blocks up from the end works too, whenever the message's digit count is a multiple of the block size. The worksheets' readers have both options, plus a coordinates reading that shows the 14- and 15-digit layouts.
- Read 072069076076079 in 3-digit character codes.
Show answer
072 069 076 076 079 → H E L L O.
- Read 805121215 as letter positions (A = 1).
Show answer
It has 9 digits, an odd number, so put back the leading zero: 08 05 12 12 15 → H E L L O.
- After 15 digits of coordinates, a decrypted number ends in 105210801088. What does that say, and why 4-digit blocks?
Show answer
1052 1080 1088 → М и р, “Мир”, Russian for “peace”. The codes are above 255, so they're Cyrillic letters and need 4 digits each.