1base32::hex(n) Base32 encoding base32::hex(n)
2
3
4
5______________________________________________________________________________
6
8 base32::hex - base32 extended hex encoding
9
11 package require Tcl 8.4
12
13 package require base32::core ?0.1?
14
15 package require base32::hex ?0.1?
16
17 ::base32::hex::encode string
18
19 ::base32::hex::decode estring
20
21______________________________________________________________________________
22
24 This package provides commands for encoding and decoding of strings
25 into and out of the extended hex base32 encoding as specified in the
26 RFC 3548bis draft.
27
29 ::base32::hex::encode string
30 This command encodes the given string in extended hex base32 and
31 returns the encoded string as its result. The result may be
32 padded with the character = to signal a partial encoding at the
33 end of the input string.
34
35 ::base32::hex::decode estring
36 This commands takes the estring and decodes it under the assump‐
37 tion that it is a valid extended hex base32 encoded string. The
38 result of the decoding is returned as the result of the command.
39
40 Note that while the encoder will generate only uppercase charac‐
41 ters this decoder accepts input in lowercase as well.
42
43 The command will always throw an error whenever encountering
44 conditions which signal some type of bogus input, namely if
45
46 [1] the input contains characters which are not valid output
47 of a extended hex base32 encoder,
48
49 [2] the length of the input is not a multiple of eight,
50
51 [3] padding appears not at the end of input, but in the mid‐
52 dle,
53
54 [4] the padding has not of length six, four, three, or one
55 characters,
56
58 The code map used to convert 5-bit sequences is shown below, with the
59 numeric id of the bit sequences to the left and the character used to
60 encode it to the right. The important feature of the extended hex map‐
61 ping is that the first 16 codes map to the digits and hex characters.
62
63
64 0 0 9 9 18 I 27 R
65 1 1 10 A 19 J 28 S
66 2 2 11 B 20 K 29 T
67 3 3 12 C 21 L 30 U
68 4 4 13 D 22 M 31 V
69 5 5 14 E 23 N
70 6 6 15 F 24 O
71 7 7 16 G 25 P
72 8 8 17 H 26 Q
73
74
76 This document, and the package it describes, will undoubtedly contain
77 bugs and other problems. Please report such in the category base32 of
78 the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. Please
79 also report any ideas for enhancements you may have for either package
80 and/or documentation.
81
82 When proposing code changes, please provide unified diffs, i.e the out‐
83 put of diff -u.
84
85 Note further that attachments are strongly preferred over inlined
86 patches. Attachments can be made by going to the Edit form of the
87 ticket immediately after its creation, and then using the left-most
88 button in the secondary navigation bar.
89
91 base32, hex, rfc3548
92
94 Text processing
95
97 Public domain
98
99
100
101
102tcllib 0.1 base32::hex(n)