move base64 to contrib/base64
parent
cd7a57dfb0
commit
6571d6fc51
|
@ -9,6 +9,7 @@ Available libraries:
|
|||
|
||||
- alien -- Alien utility words (Eduardo Cavazos)
|
||||
- automata -- Graphics demo for the UI (Eduardo Cavazos)
|
||||
- base64 -- base64 encoding/decoding (Doug Coleman)
|
||||
- benchmarks -- Various performance benchmarks (Slava Pestov)
|
||||
- boids -- Graphics demo for the UI (Eduardo Cavazos)
|
||||
- cairo -- cairo bindings (Sampo Vuori)
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
USING: kernel math math-contrib sequences namespaces io strings hashtables ;
|
||||
IN: crypto-internals
|
||||
USING: kernel math sequences namespaces io strings hashtables ;
|
||||
IN: base64-internals
|
||||
|
||||
: count-end ( seq quot -- count )
|
||||
>r [ length ] keep r> find-last drop dup -1 = [ 2drop 0 ] [ - 1- ] if ;
|
||||
|
||||
: ch>base64 ( ch -- ch )
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" nth ;
|
||||
|
@ -22,7 +25,7 @@ IN: crypto-internals
|
|||
: >base64-rem ( str -- str )
|
||||
[ 3 0 pad-right encode3 ] keep length 1+ head 4 CHAR: = pad-right ;
|
||||
|
||||
IN: crypto
|
||||
IN: base64
|
||||
: >base64 ( str -- str )
|
||||
#! cut string into two pieces, convert 3 bytes at a time
|
||||
#! pad string with = when not enough bits
|
|
@ -0,0 +1,7 @@
|
|||
PROVIDE: contrib/base64
|
||||
{ +files+ {
|
||||
"base64.factor"
|
||||
} }
|
||||
{ +tests+ {
|
||||
"test.factor"
|
||||
} } ;
|
|
@ -1,8 +1,8 @@
|
|||
USING: kernel math test namespaces crypto ;
|
||||
USING: test base64 ;
|
||||
|
||||
[ "abcdefghijklmnopqrstuvwxyz" ] [ "abcdefghijklmnopqrstuvwxyz" >base64 base64> ] unit-test
|
||||
[ "abcdefghijklmnopqrstuvwxyz" ] [ "abcdefghijklmnopqrstuvwxyz" >base64 base64>
|
||||
] unit-test
|
||||
[ "" ] [ "" >base64 base64> ] unit-test
|
||||
[ "a" ] [ "a" >base64 base64> ] unit-test
|
||||
[ "ab" ] [ "ab" >base64 base64> ] unit-test
|
||||
[ "abc" ] [ "abc" >base64 base64> ] unit-test
|
||||
|
|
@ -5,7 +5,6 @@ PROVIDE: contrib/crypto
|
|||
|
||||
"common.factor"
|
||||
"timing.factor"
|
||||
"base64.factor"
|
||||
"barrett.factor"
|
||||
"montgomery.factor"
|
||||
"random.factor"
|
||||
|
@ -32,7 +31,6 @@ PROVIDE: contrib/crypto
|
|||
"test/md5.factor"
|
||||
"test/sha1.factor"
|
||||
"test/sha2.factor"
|
||||
"test/base64.factor"
|
||||
"test/miller-rabin.factor"
|
||||
"test/crc32.factor"
|
||||
"test/rsa.factor"
|
||||
|
|
Loading…
Reference in New Issue