commit 7640aa7610cd901dec00a5bb0a1f7fccf237ebb8 parent fe16b60c3d0dd16121a459095d759d06555ba227 Author: Martin Schanzenbach <schanzen@gnunet.org> Date: Thu, 29 Jun 2023 13:12:03 +0200 fix base32 Diffstat:
| M | draft-schanzen-gns.xml | | | 31 | +++++++++++++++++++------------ |
1 file changed, 19 insertions(+), 12 deletions(-)
diff --git a/draft-schanzen-gns.xml b/draft-schanzen-gns.xml @@ -3709,10 +3709,16 @@ Host: 000G0037FH3QTBCK15Y8BCCNRVWPV17ZC7TSGB1C9ZG2TPGHZVFV1GMG3W <section> <name>Base32GNS</name> <t> - This table defines the encode symbol and decode symbol for a given + Encoding converts a byte array into a string of symbols. + Decoding converts a string of symbols into a byte array. + Decoding fails if the input string has symbols outside the defined set. + </t> + <t> + This table defines the encode and decode symbols for a given symbol value. + Each symbol value is 5 bit. It can be used to implement the encoding by reading it as: - A character "A" or "a" is decoded to a 5 bit value 10 when decoding. + A symbol "A" or "a" is decoded to a 5 bit value 10 when decoding. A 5 bit block with a value of 18 is encoded to the character "J" when encoding. If the bit length of the byte string to encode is not a multiple of 5 it is padded to the next multiple with zeroes. @@ -3770,23 +3776,24 @@ Value Symbol Symbol <section> <name>Base32GNS en-/decoding</name> <t> - Encoding (⇀) converts a byte array into a string; decoding (↽) converts - a string into a byte array. Decoding fails if the input string has - characters outside the defined Base32GNS character set (<tt>[0..9][A-Z][a-z]</tt>). - (N.B.: Strings are encoded without <tt>\0</tt> terminator) + The following are test vectors for the Base32GNS encoding used for zTLDs. The input strings are encoded without the zero terminator. </t> <artwork name="" type="" align="left" alt=""> <![CDATA[ -59 40 B3 2D B8 86 61 C2 ⇌ B50B6BDRGSGW4 +Base32GNS-Encode: + Input string: "Hello World" + Output string: "91JPRV3F41BPYWKCCG" -48 65 6c 6c 6f 20 57 6f 72 6c 64 ⇌ 91JPRV3F41BPYWKCCG -H e l l o W o r l d + Input bytes: 474e55204e616d652053797374656d + Output string: "8X75A82EC5PPA82KF5SQ8SBD" -48 65 6c 6c 6f 20 57 6f 72 6c 64 ↽ 91JPRU3F4IBPYWKCCG -H e l l o W o r l d +Base32GNS-Decode: + Input string: "91JPRV3F41BPYWKCCG" + Output string: "Hello World" -**FAILURE** ↽ 91JPR+3F4!BPYWKCCG + Input string: "91JPRU3F41BPYWKCCG" + Output string: "Hello World" ]]> </artwork> </section>