diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2023-06-29 13:12:03 +0200 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2023-06-29 13:12:03 +0200 |
commit | 7640aa7610cd901dec00a5bb0a1f7fccf237ebb8 (patch) | |
tree | 78ca3089eef1221eae58312155f33a1641412003 | |
parent | fe16b60c3d0dd16121a459095d759d06555ba227 (diff) | |
download | lsd0001-7640aa7610cd901dec00a5bb0a1f7fccf237ebb8.tar.gz lsd0001-7640aa7610cd901dec00a5bb0a1f7fccf237ebb8.zip |
fix base32
-rw-r--r-- | draft-schanzen-gns.xml | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/draft-schanzen-gns.xml b/draft-schanzen-gns.xml index e2bcbc6..a24189d 100644 --- a/draft-schanzen-gns.xml +++ b/draft-schanzen-gns.xml | |||
@@ -3709,10 +3709,16 @@ Host: 000G0037FH3QTBCK15Y8BCCNRVWPV17ZC7TSGB1C9ZG2TPGHZVFV1GMG3W | |||
3709 | <section> | 3709 | <section> |
3710 | <name>Base32GNS</name> | 3710 | <name>Base32GNS</name> |
3711 | <t> | 3711 | <t> |
3712 | This table defines the encode symbol and decode symbol for a given | 3712 | Encoding converts a byte array into a string of symbols. |
3713 | Decoding converts a string of symbols into a byte array. | ||
3714 | Decoding fails if the input string has symbols outside the defined set. | ||
3715 | </t> | ||
3716 | <t> | ||
3717 | This table defines the encode and decode symbols for a given | ||
3713 | symbol value. | 3718 | symbol value. |
3719 | Each symbol value is 5 bit. | ||
3714 | It can be used to implement the encoding by reading it as: | 3720 | It can be used to implement the encoding by reading it as: |
3715 | A character "A" or "a" is decoded to a 5 bit value 10 when decoding. | 3721 | A symbol "A" or "a" is decoded to a 5 bit value 10 when decoding. |
3716 | A 5 bit block with a value of 18 is encoded to the character "J" when encoding. | 3722 | A 5 bit block with a value of 18 is encoded to the character "J" when encoding. |
3717 | If the bit length of the byte string to encode is not a multiple of 5 | 3723 | If the bit length of the byte string to encode is not a multiple of 5 |
3718 | it is padded to the next multiple with zeroes. | 3724 | it is padded to the next multiple with zeroes. |
@@ -3770,23 +3776,24 @@ Value Symbol Symbol | |||
3770 | <section> | 3776 | <section> |
3771 | <name>Base32GNS en-/decoding</name> | 3777 | <name>Base32GNS en-/decoding</name> |
3772 | <t> | 3778 | <t> |
3773 | Encoding (⇀) converts a byte array into a string; decoding (↽) converts | 3779 | The following are test vectors for the Base32GNS encoding used for zTLDs. The input strings are encoded without the zero terminator. |
3774 | a string into a byte array. Decoding fails if the input string has | ||
3775 | characters outside the defined Base32GNS character set (<tt>[0..9][A-Z][a-z]</tt>). | ||
3776 | (N.B.: Strings are encoded without <tt>\0</tt> terminator) | ||
3777 | </t> | 3780 | </t> |
3778 | 3781 | ||
3779 | <artwork name="" type="" align="left" alt=""> | 3782 | <artwork name="" type="" align="left" alt=""> |
3780 | <![CDATA[ | 3783 | <![CDATA[ |
3781 | 59 40 B3 2D B8 86 61 C2 ⇌ B50B6BDRGSGW4 | 3784 | Base32GNS-Encode: |
3785 | Input string: "Hello World" | ||
3786 | Output string: "91JPRV3F41BPYWKCCG" | ||
3782 | 3787 | ||
3783 | 48 65 6c 6c 6f 20 57 6f 72 6c 64 ⇌ 91JPRV3F41BPYWKCCG | 3788 | Input bytes: 474e55204e616d652053797374656d |
3784 | H e l l o W o r l d | 3789 | Output string: "8X75A82EC5PPA82KF5SQ8SBD" |
3785 | 3790 | ||
3786 | 48 65 6c 6c 6f 20 57 6f 72 6c 64 ↽ 91JPRU3F4IBPYWKCCG | 3791 | Base32GNS-Decode: |
3787 | H e l l o W o r l d | 3792 | Input string: "91JPRV3F41BPYWKCCG" |
3793 | Output string: "Hello World" | ||
3788 | 3794 | ||
3789 | **FAILURE** ↽ 91JPR+3F4!BPYWKCCG | 3795 | Input string: "91JPRU3F41BPYWKCCG" |
3796 | Output string: "Hello World" | ||
3790 | ]]> | 3797 | ]]> |
3791 | </artwork> | 3798 | </artwork> |
3792 | </section> | 3799 | </section> |