! Copyright (C) 2008 Doug Coleman, Daniel Ehrenberg.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays assocs byte-arrays combinators fry io io.binary
-io.encodings.binary io.streams.byte-array kernel literals math
-namespaces sbufs sequences ;
+io.encodings.binary io.streams.byte-array kernel kernel.private
+literals math namespaces sbufs sequences ;
IN: base64
ERROR: malformed-base64 ;
: base64>ch ( ch -- ch )
$[ alphabet alphabet-inverse 0 CHAR: = pick set-nth ] nth
- [ malformed-base64 ] unless* ; inline
+ [ malformed-base64 ] unless* { fixnum } declare ; inline
: (write-lines) ( column byte-array -- column' )
output-stream get dup '[
! Copyright (C) 2019 John Benediktsson.
! See http://factorcode.org/license.txt for BSD license.
USING: base64.private byte-arrays combinators io
-io.encodings.binary io.streams.byte-array kernel literals locals
-math namespaces sequences ;
+io.encodings.binary io.streams.byte-array kernel kernel.private
+literals locals math namespaces sequences ;
IN: base16
ERROR: malformed-base16 ;
: base16>ch ( ch -- ch )
$[ alphabet alphabet-inverse ] nth
- [ malformed-base16 ] unless* ; inline
+ [ malformed-base16 ] unless* { fixnum } declare ; inline
:: (encode-base16) ( stream -- )
stream stream-read1 [
! Copyright (C) 2019 John Benediktsson
! See http://factorcode.org/license.txt for BSD license
USING: base64.private byte-arrays combinators fry io io.binary
-io.encodings.binary io.streams.byte-array kernel literals math
-namespaces sequences ;
+io.encodings.binary io.streams.byte-array kernel kernel.private
+literals math namespaces sequences ;
IN: base32
ERROR: malformed-base32 ;
: base32>ch ( ch -- ch )
$[ alphabet alphabet-inverse 0 CHAR: = pick set-nth ] nth
- [ malformed-base32 ] unless* ; inline
+ [ malformed-base32 ] unless* { fixnum } declare ; inline
: encode5 ( seq -- byte-array )
be> { -35 -30 -25 -20 -15 -10 -5 0 } '[
! Copyright (C) 2013 John Benediktsson.
! See http://factorcode.org/license.txt for BSD license.
USING: base64.private byte-arrays combinators io io.binary
-io.encodings.binary io.streams.byte-array kernel literals math
-namespaces sequences ;
+io.encodings.binary io.streams.byte-array kernel kernel.private
+literals math namespaces sequences ;
IN: base85
ERROR: malformed-base85 ;
: base85>ch ( ch -- ch )
$[ alphabet alphabet-inverse ] nth
- [ malformed-base85 ] unless* ; inline
+ [ malformed-base85 ] unless* { fixnum } declare ; inline
: encode4 ( seq -- seq' )
be> 5 [ 85 /mod ch>base85 ] B{ } replicate-as reverse! nip ; inline
! Copyright (C) 2019 John Benediktsson.
! See http://factorcode.org/license.txt for BSD license.
-USING: base64.private byte-arrays kernel literals locals math
-sequences ;
+USING: base64.private byte-arrays kernel kernel.private
+literals locals math sequences ;
IN: base91
ERROR: malformed-base91 ;
: base91>ch ( ch -- ch )
$[ alphabet alphabet-inverse ] nth
- [ malformed-base91 ] unless* ; inline
+ [ malformed-base91 ] unless* { fixnum } declare ; inline
PRIVATE>