Skip to content

Commit 5d1eb77

Browse files
committed
base32: don't '=' pad the zbase32
1 parent 53d7e6d commit 5d1eb77

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

basis/base32/base32-docs.factor

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ HELP: zbase32>
3434
{ $values { "zbase32" sequence } { "seq" sequence } }
3535
{ $description "Decode from the \"human-oriented\" Base32 encoding." } ;
3636

37-
3837
ARTICLE: "base32" "Base32 conversions"
3938
"The " { $vocab-link "base32" } " vocabulary supports encoding and decoding of various Base32 encoding formats, including:"
4039
$nl
@@ -55,7 +54,7 @@ $nl
5554
>base32-crockford-checksum
5655
base32-crockford-checksum>
5756
}
58-
"Human-oriented Base32 encoding:"
57+
"Human-oriented Base32 encoding, described in " { $url "http://philzimmermann.com/docs/human-oriented-base-32-encoding.txt" } ":"
5958
{ $subsections
6059
>zbase32
6160
zbase32>

basis/base32/base32-tests.factor

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ USING: base32 byte-arrays kernel sequences strings tools.test ;
1313
{ "MFRGG===" } [ "abc" >base32 "" like ] unit-test
1414
{ "MFRGGZA=" } [ "abcd" >base32 "" like ] unit-test
1515
{ "MFRGGZDF" } [ "abcde" >base32 "" like ] unit-test
16-
1716
{ B{ } } [ f base32> ] unit-test
1817
{ B{ } } [ B{ } base32> ] unit-test
1918
{ "\0" } [ "AA======" base32> "" like ] unit-test
@@ -92,17 +91,17 @@ USING: base32 byte-arrays kernel sequences strings tools.test ;
9291
{ 0 } [ "00" base32-crockford-checksum> ] unit-test
9392

9493
{ "" } [ "" >zbase32 >string ] unit-test
95-
{ "ca======" } [ "f" >zbase32 >string ] unit-test
96-
{ "c3zo====" } [ "fo" >zbase32 >string ] unit-test
97-
{ "c3zs6===" } [ "foo" >zbase32 >string ] unit-test
98-
{ "c3zs6ao=" } [ "foob" >zbase32 >string ] unit-test
94+
{ "ca" } [ "f" >zbase32 >string ] unit-test
95+
{ "c3zo" } [ "fo" >zbase32 >string ] unit-test
96+
{ "c3zs6" } [ "foo" >zbase32 >string ] unit-test
97+
{ "c3zs6ao" } [ "foob" >zbase32 >string ] unit-test
9998
{ "c3zs6aub" } [ "fooba" >zbase32 >string ] unit-test
100-
{ "c3zs6aubqe======" } [ "foobar" >zbase32 >string ] unit-test
99+
{ "c3zs6aubqe" } [ "foobar" >zbase32 >string ] unit-test
101100

102101
{ "" } [ "" zbase32> >string ] unit-test
103-
{ "f" } [ "ca======" zbase32> >string ] unit-test
104-
{ "fo" } [ "c3zo====" zbase32> >string ] unit-test
105-
{ "foo" } [ "c3zs6===" zbase32> >string ] unit-test
106-
{ "foob" } [ "c3zs6ao=" zbase32> >string ] unit-test
102+
{ "f" } [ "ca" zbase32> >string ] unit-test
103+
{ "fo" } [ "c3zo" zbase32> >string ] unit-test
104+
{ "foo" } [ "c3zs6" zbase32> >string ] unit-test
105+
{ "foob" } [ "c3zs6ao" zbase32> >string ] unit-test
107106
{ "fooba" } [ "c3zs6aub" zbase32> >string ] unit-test
108-
{ "foobar" } [ "c3zs6aubqe======" zbase32> >string ] unit-test
107+
{ "foobar" } [ "c3zs6aubqe" zbase32> >string ] unit-test

basis/base32/base32.factor

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,7 @@ CONSTANT: zbase32-alphabet $[ "ybndrfg8ejkmcpqxot1uwisza345h769" >byte-array ]
207207
] with B{ } map-as ; inline
208208

209209
: zencode-pad ( seq n -- byte-array )
210-
[ 5 0 pad-tail zencode5 ] [ B{ 0 2 4 5 7 } nth ] bi* head-slice
211-
8 CHAR: = pad-tail ; inline
210+
[ 5 0 pad-tail zencode5 ] [ B{ 0 2 4 5 7 } nth ] bi* head ;
212211

213212
: (encode-zbase32) ( stream column -- )
214213
5 pick stream-read dup length {

0 commit comments

Comments
 (0)