>base92 ( seq -- base92 )
Base92 conversions

Next:base92> ( base92 -- seq )


Vocabulary
base92

Inputs
seqa sequence


Outputs
base92a sequence


Word description
Encode into Base92 encoding.

Definition


:: >base92 ( seq -- base92 )
0 :> b! 0 :> n! BV{ } clone :> accum seq [
b 8 shift bitor b! n 8 + n! n 13 >= [
b n 13 - neg shift 8191 bitand 91 /mod
[ ch>base92 accum push ] bi@ n 13 - n!
] when
] each n 0 > [
n 7 <
[ b 6 n - shift 63 bitand ch>base92 accum push ] [
b 13 n - shift 8191 bitand 91 /mod
[ ch>base92 accum push ] bi@
] if
] when accum [ 126 1byte-array ] [ B{ } like ] if-empty ;