-
Notifications
You must be signed in to change notification settings - Fork 1
base64
Content automatically generated. Contributions from the community are very welcomed at the bottom of this file.
- Intro
- Dependencies
- Test dependencies
- Foreign dependencies
- API
- Examples
- Author(s)
- Maintainer(s)
- Version
- License
- Tags
Implementation of Base64 encoding ported from Chibi Scheme.
None
None
None
Read and write encoding to default input / output ports, or specific ports if given.
Return a base64 encoded representation of string according to the official base64 standard as described in RFC3548.
Return a base64 encoded representation of bytevector according to the official base64 standard as described in RFC3548.
Read and write decoding to default input / output ports, or specific ports if given.
Return a base64 decoded representation of string, also interpreting the alternate 62 & 63 valued characters as described in RFC3548. Other out-of-band characters are silently stripped, and = signals the end of the encoded string. No errors will be raised.
Create a result buffer with the maximum possible length for the input, and pass it to the internal base64-decode-string! utility. If the resulting length used is exact, we can return that buffer, otherwise we return the appropriate substring.
Same as above but decode the given bytevector.
Return a base64 encoded representation of the string str
as per RFC1522, split across multiple MIME-header lines as needed to keep each lines length less than max-col
. The string is encoded as is, and the encoding enc
is just used for the prefix, i.e. you are responsible for ensuring str
is already encoded according to enc
. The optional argument nl
is the newline separator, defaulting to crlf
.
(import (scheme base)
(cyclone base64)
(cyclone string)
(cyclone test))
(test-group "base64"
(test "YW55IGNhcm5hbCBwbGVhc3VyZS4="
(base64-encode-string "any carnal pleasure."))
(test "YW55IGNhcm5hbCBwbGVhc3VyZQ=="
(base64-encode-string "any carnal pleasure"))
(test "YW55IGNhcm5hbCBwbGVhc3Vy"
(base64-encode-string "any carnal pleasur"))
(test "YW55IGNhcm5hbCBwbGVhc3U="
(base64-encode-string "any carnal pleasu"))
(test "YW55IGNhcm5hbCBwbGVhcw=="
(base64-encode-string "any carnal pleas"))
(test "any carnal pleas"
(base64-decode-string "YW55IGNhcm5hbCBwbGVhcw=="))
(test "any carnal pleasu"
(base64-decode-string "YW55IGNhcm5hbCBwbGVhc3U="))
(test "any carnal pleasur"
(base64-decode-string "YW55IGNhcm5hbCBwbGVhc3Vy"))
(test "any carnal pleas"
(base64-decode-string "YW55IGNhcm5hbCBwbGVhcw"))
(test "any carnal pleasu"
(base64-decode-string "YW55IGNhcm5hbCBwbGVhc3U"))
)
(test-exit)
Alex Shinn
Justin Ethier
0.3
BSD
networking