rfc9285v3.txt   rfc9285.txt 
Internet Engineering Task Force (IETF) P. Fältström Internet Engineering Task Force (IETF) P. Fältström
Request for Comments: 9285 Netnod Request for Comments: 9285 Netnod
Category: Informational F. Ljunggren Category: Informational F. Ljunggren
ISSN: 2070-1721 Kirei ISSN: 2070-1721 Kirei
D. van Gulik D.W. van Gulik
Webweaving Webweaving
August 2022 August 2022
The Base45 Data Encoding The Base45 Data Encoding
Abstract Abstract
This document describes the Base45 encoding scheme, which is built This document describes the Base45 encoding scheme, which is built
upon the Base64, Base32, and Base16 encoding schemes. upon the Base64, Base32, and Base16 encoding schemes.
skipping to change at line 194 skipping to change at line 194
Table 1: The Base45 Alphabet Table 1: The Base45 Alphabet
4.3. Encoding Examples 4.3. Encoding Examples
It should be noted that although the examples are all text, Base45 is It should be noted that although the examples are all text, Base45 is
an encoding for binary data where each octet can have any value an encoding for binary data where each octet can have any value
0-255. 0-255.
Encoding example 1: Encoding example 1:
The string "AB" is the byte sequence [[65 66]]. The string "AB" is the byte sequence [[65 66]]. If we look at all
If we look at all 16 bits, we get 65 * 256 + 66 = 16706. 16 bits, we get 65 * 256 + 66 = 16706. 16706 equals 11 + (11 *
16706 equals 11 + (11 * 45) + (8 * 45 * 45), so the sequence in 45) + (8 * 45 * 45), so the sequence in base 45 is [11 11 8].
base 45 is [11 11 8].
Referring to Table 1, we get the encoded string "BB8". Referring to Table 1, we get the encoded string "BB8".
+-----------+------------------+ +-----------+------------------+
| AB | Initial string | | AB | Initial string |
+-----------+------------------+ +-----------+------------------+
| [[65 66]] | Decimal value | | [[65 66]] | Decimal value |
+-----------+------------------+ +-----------+------------------+
| [16706] | Value in base 16 | | [16706] | Value in base 16 |
+-----------+------------------+ +-----------+------------------+
| [11 11 8] | Value in base 45 | | [11 11 8] | Value in base 45 |
+-----------+------------------+ +-----------+------------------+
| BB8 | Encoded string | | BB8 | Encoded string |
+-----------+------------------+ +-----------+------------------+
Table 2: Example 1 in Detail Table 2: Example 1 in Detail
Encoding example 2: Encoding example 2:
The string "Hello!!" as ASCII is the byte sequence [[72 101] [108 The string "Hello!!" as ASCII is the byte sequence [[72 101] [108
108] [111 33] [33]]. 108] [111 33] [33]]. If we look at this 16 bits at a time, we get
If we look at this 16 bits at a time, we get [18533 27756 28449 [18533 27756 28449 33]. Note the 33 for the last byte. When
33]. Note the 33 for the last byte. looking at the values in base 45, we get [[38 6 9] [36 31 13] [9 2
When looking at the values in base 45, we get [[38 6 9] [36 31 13] 14] [33 0]], where the last byte is represented by two values.
[9 2 14] [33 0]], where the last byte is represented by two
values.
The resulting string "%69 VD92EX0" is created by looking up these The resulting string "%69 VD92EX0" is created by looking up these
values in Table 1. It should be noted it includes a space. values in Table 1. It should be noted it includes a space.
+---------------------------------------+------------------+ +---------------------------------------+------------------+
| Hello!! | Initial string | | Hello!! | Initial string |
+---------------------------------------+------------------+ +---------------------------------------+------------------+
| [[72 101] [108 108] [111 33] [33]] | Decimal value | | [[72 101] [108 108] [111 33] [33]] | Decimal value |
+---------------------------------------+------------------+ +---------------------------------------+------------------+
| [18533 27756 28449 33] | Value in base 16 | | [18533 27756 28449 33] | Value in base 16 |
+---------------------------------------+------------------+ +---------------------------------------+------------------+
| [[38 6 9] [36 31 13] [9 2 14] [33 0]] | Value in base 45 | | [[38 6 9] [36 31 13] [9 2 14] [33 0]] | Value in base 45 |
+---------------------------------------+------------------+ +---------------------------------------+------------------+
| %69 VD92EX0 | Encoded string | | %69 VD92EX0 | Encoded string |
+---------------------------------------+------------------+ +---------------------------------------+------------------+
Table 3: Example 2 in Detail Table 3: Example 2 in Detail
Encoding example 3: Encoding example 3:
The string "base-45" as ASCII is the byte sequence [[98 97] [115 The string "base-45" as ASCII is the byte sequence [[98 97] [115
101] [45 52] [53]]. 101] [45 52] [53]]. If we look at this two bytes at a time, we
If we look at this two bytes at a time, we get [25185 29541 11572 get [25185 29541 11572 53]. Note the 53 for the last byte. When
53]. Note the 53 for the last byte. looking at the values in base 45, we get [[30 19 12] [21 26 14] [7
When looking at the values in base 45, we get [[30 19 12] [21 26 32 5] [8 1]] where the last byte is represented by two values.
14] [7 32 5] [8 1]] where the last byte is represented by two
values.
Referring to Table 1, we get the encoded string "UJCLQE7W581". Referring to Table 1, we get the encoded string "UJCLQE7W581".
+----------------------------------------+------------------+ +----------------------------------------+------------------+
| base-45 | Initial string | | base-45 | Initial string |
+----------------------------------------+------------------+ +----------------------------------------+------------------+
| [[98 97] [115 101] [45 52] [53]] | Decimal value | | [[98 97] [115 101] [45 52] [53]] | Decimal value |
+----------------------------------------+------------------+ +----------------------------------------+------------------+
| [25185 29541 11572 53] | Value in base 16 | | [25185 29541 11572 53] | Value in base 16 |
+----------------------------------------+------------------+ +----------------------------------------+------------------+
| [[30 19 12] [21 26 14] [7 32 5] [8 1]] | Value in base 45 | | [[30 19 12] [21 26 14] [7 32 5] [8 1]] | Value in base 45 |
skipping to change at line 270 skipping to change at line 265
| UJCLQE7W581 | Encoded string | | UJCLQE7W581 | Encoded string |
+----------------------------------------+------------------+ +----------------------------------------+------------------+
Table 4: Example 3 in Detail Table 4: Example 3 in Detail
4.4. Decoding Example 4.4. Decoding Example
Decoding example 1: Decoding example 1:
The string "QED8WEX0" represents, when looked up in Table 1, the The string "QED8WEX0" represents, when looked up in Table 1, the
values [26 14 13 8 32 14 33 0]. values [26 14 13 8 32 14 33 0]. We arrange the numbers in chunks
We arrange the numbers in chunks of three, except for the last one of three, except for the last one which can be two numbers, and
which can be two numbers, and get [[26 14 13] [8 32 14] [33 0]]. get [[26 14 13] [8 32 14] [33 0]]. In base 45, we get [26981
In base 45, we get [26981 29798 33] where the bytes are [[105 101] 29798 33] where the bytes are [[105 101] [116 102] [33]]. If we
[116 102] [33]]. look at the ASCII values, we get the string "ietf!".
If we look at the ASCII values, we get the string "ietf!".
+-------------------------------+------------------------+ +-------------------------------+------------------------+
| QED8WEX0 | Initial string | | QED8WEX0 | Initial string |
+-------------------------------+------------------------+ +-------------------------------+------------------------+
| [26 14 13 8 32 14 33 0] | Looked up values | | [26 14 13 8 32 14 33 0] | Looked up values |
+-------------------------------+------------------------+ +-------------------------------+------------------------+
| [[26 14 13] [8 32 14] [33 0]] | Groups of three | | [[26 14 13] [8 32 14] [33 0]] | Groups of three |
+-------------------------------+------------------------+ +-------------------------------+------------------------+
| [26981 29798 33] | Interpreted as base 45 | | [26981 29798 33] | Interpreted as base 45 |
+-------------------------------+------------------------+ +-------------------------------+------------------------+
 End of changes. 5 change blocks. 
23 lines changed or deleted 17 lines changed or added

This html diff was produced by rfcdiff 1.48.