This library provides Base 64 encoding and decoding procedures.
in must be either a bytevector or binary input port.
Encodes given input in to Base 64 encoded bytevector.
The base32hex-encode
encodes the given input to Base 32 Hex
encoded bytevector.
The keyword-options will be passed to the encoder. See make-base32-encoder
procedure for more detail.
Convenient procedure for string.
Encodes given string to Base 64 encoded string.
The keyword argument transcoder is used to convert given string to
bytevector. The converted bytevector will be passed to the base32-encode
procedure. The default value is a transcoder with UTF-8 codec with EOL
style none.
The base32hex-encode-string
encodes the given input to Base 32 Hex
encoded bytevector.
The keyword-options will be passed to the encoder. See make-base32-encoder
procedure for more detail.
Creates binary Base32 encode input and output port, respectively.
source must be binary inpurt port.
The input port reads bytes from source and returns Base32 encoded result.
sink must be binary inpurt port.
The output port puts encoded bytes to sink. The port must be closed to finish the encoding process properly.
The open-base32hex-encode-input-port
and
open-base32hex-encode-output-port
encode to Base32 Hex encode.
The keyword-options will be passed to the encoder. See make-base32-encoder
procedure for more detail.
in must be a bytevector or binary input port.
Decode Base 64 encoded input in to original bytevector.
The base32hex-decode
decodes Base32 Hex encoded value.
The keyword-options will be passed to the encoder. See make-base32-decoder
procedure for more detail.
Convenient procedure.
Decode Base 64 encoded string to original string. The procedure is using
base32-decode
.
The keyword argument specifies how to convert the decoded bytevector to string. If this is #f, the procedure returns raw bytevector.
The base32hex-decode-string
decodes Base32 Hex safe encoded value.
The keyword-options will be passed to the encoder. See make-base32-decoder
procedure for more detail.
Creates binary Base32 decode input and output port, respectively.
source must be binary inpurt port.
The input port reads Base32 encoded bytes from source and returns decoded results.
sink must be binary inpurt port.
The output port puts decoded bytes to sink. The port must be closed to finish the encoding process properly.
The open-base32hex-decode-input-port
and
open-base32hex-decode-output-port
decode Base32 Hex safe encoded
value.
The keyword-options will be passed to the encoder. See make-base32-decoder
procedure for more detail.
Both encode and decode procedures are using encoder and decoder. Both encoder and decoder are just a procedure which takes 2 arguments get and put and not reentrant as they have own internal buffer to process the input.
encode-table must be a valid Base 32 encode table.
line-width must be either #f
or integer.
padding? must be a boolean value.
linefeeds must be #f
or u8 list reporesents end of line.__
Creates a Base32 encoder. An encoder is a procedure which takes 2 arguments get and put.
get must be a procedure takes 0 argument and it must return one of the followings; a fixnum of range 0 to 255, EOF object, or negative integer. The fixnum value is treated as an input of the encoding value. The negative integer value is treated as a continue marker. When the encoder receives this value, then it won't encode until the next value is available.
put must be a procedure takes 1 argument which is either a
fixnum of range 0 to 255 or #f
. The fixnum is the encoded value
of the input. #f
indicates line break point, so user can
determine which line break this encoder should use.
The keyword argument encode-table specifies the encoding rule. The procedure name represents the default value of the rule, however if you specify the other table, then it can encode the value according to the given value.
The keyword argument line-width specifies where the encode procedure should put linefeed. If this is less than 1 or #f, encoder does not put linefeed.
The keyword argument padding? controls if the result encoded value
contains padding character #\=
or not. If this is #f, then the result
value won't contain padding character.
The keyword argument linefeeds controls the end of line. By default,
it emits LF (0x0a)
. If you want to put CRLF, then you can specify this
value with (#x0d #x0a)
decode-table must be a valid Base 32 decode table.
Creates a Base32 decoder. A decoder is a procedure which takes 2 arguments get and put.
get is the same as the one from encoder.
put must be a procedure takes 1 arguments which is a fixnm of range 0 to 255. The value is always a decoded byte.
The keyword argument decode-table specifies the decoding rule. The procedure name represents the default value of the rule, however if you specify the other table, then it can decode the value according to the given value.
Default encode or decode tables. If the name contains url
, then it
is suitable for "base32hex".