Skip to main content
Deno 2 is finally here 🎉️
Learn more

Cubic

Cubic is a 24-bit character encoding/character set.

API

cubic.encode(str: string): Uint8Array

Converts Unicode characters to the equivalent Cubic characters.

cubic.decode(bytes: Uint8Array): Uint8Array

Converts Cubic characters to the equivalent Unicode characters.

How It Works

Each character takes 3 bytes, so for example, the character A would look like in bytes:

0x0000 0x0000 0x0041

So;

Hello world!

Would be(In bytes):

0x0000 0x0000 0x0048 0x0000 0x0000 0x0065 0x0000 0x0000 0x006C 0x0000 0x0000 0x006 0x0000 0x0000 0x006F 0x0000 0x0000 0x002C 0x0000 0x0000 0x0077 0x0000 0x0000 0x006F 0x0000 0x0000 0x0072 0x0000 0x0000 0x006C 0x0000 0x0000 0x0064 0x0000 0x0000 0x0021

see characters.ts for a full list of cubic characters.

Fun Facts

  • The maximum amount of characters in the cubic character set is 18,479,416,849,807,100,625… That’s probably more than we will need for the next couple decades(at least).