Encodings
Octal
Every byte as an octal number from 0 to 377. Spaced by default and decoding takes commas too
Encoding / Octal
Octal
A number a byte in base 8. Looks like decimal, isn't.
- Overhead
- +172% on random bytes
- Padding
- none
- Standard
- Byte values in base 8
- Family
- 1 in octal
family 1 / 21
Sample
- Out
- 150 145 154 154 157 40 167 157 162 154 144 41
- Back
- "hello world!"
01234567
Options
Access
- Import
import { octal } from "@agntn/encodings/octal" - CLI
encodings encode octal 'hello world!' - Tryplayground with the sample above
Base 8, one number per byte. It looks like decimal. It isn't.
encode("octal", "Hi"); // "110 151"
encode("octal", "Hi", { separate: false }); // "110151"
Is 110 a hundred and ten? Not here. It's H. Puzzles know this and use it on purpose.
Decoding splits on spaces and commas. A run with no separator reads three digits per byte, which is what separate: false writes. An 8 or a 9 is an error. So is anything over 377, because a byte ends there.