|
HikoGUI
A low latency retained GUI
|
The base-93 format is used to encode binary data into ASCII data so that a user is able to copy this data using copy-and-paste from one application to another.
This is for example useful for license code, or for moving snippets of application settings.
The encoding efficiency is calculated as follows:
The base-93 alphabet contains all 94 printable ASCII characters.
The first 93 characters ASCII '!' up to and including '}' represents a base-93 digit. '!' codes the value 0, '}' encodes the value 92.
ASCII '~' character is used to start a command.
All non-printable characters are ignored, characters outside the ASCII range are an error.
The characters "~b93{" starts a data section. Character left of "~b93{" are ignored by the decoder, this allows a clear-text description of the data.
The characters "~}" stops a data section. Character right of "~}" are ignored by the decoder, this allows a clear-text description of the data.
A base-93 number is 13 characters in length, except for the last number in a message which may be smaller depending on the number of bytes encoded, as shown in the table below:
| digits | bits | bytes | unused |
|---|---|---|---|
| 2 | 13 | 1 | 0 |
| 4 | 26 | 2 | 5 |
| 5 | 32 | 3 | 3 |
| 6 | 39 | 4 | 2 |
| 7 | 45 | 5 | 0 |
| 9 | 58 | 6 | 5 |
| 10 | 65 | 7 | 4 |
| 11 | 71 | 8 | 2 |
| 12 | 78 | 9 | 1 |
| 13 | 85 | 10 | 0 |
Constructing a 85 bit unsigned integer from these digits as follows:
The number includes a number of bytes, a 5 bit CRC and unused bits which are set to zero.
We use as basis the CRC-5-USB polynomial x^5 + x^2 + 1 which yields a divisor 0b1'00101. Each number of 13 digits and smaller is first converted to an 85 bit unsigned integer and then the location of this number is prepended in front of this integer. The location starts at zero and for each number in the message it is incremented by one.
The checksum is correct when the result is zero in the algorithm below:
The bytes are extracted from the number with the following algorithm: