<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>S-BASE64</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="description" content="S-BASE64 is Common Lisp implementation of Base64 Encoding/Decoding" />
<meta name="keywords" content="base64, rfc1421, rfc2045, rfc3548, common lisp, lisp" />
<meta name="author" content="Sven Van Caekenberghe" />
<meta name="Copyright" content="Copyright (c) 2002-2006 Sven Van Caekenberghe, Beta Nine BVBA" />
<style type="text/css">
body {
  background: white;
  width: 900px;
  font-family: Verdana, Arial, Helvetica, sans-serif;
  font-size: 13px;
}
p {
  width: 600px;
  padding: 0 20px 10px 50px;
} 
ul {
  width: 600px;
  padding: 0 5px 5px 70px;
} 
.author {
  padding: 0 20px 5px 50px;
  font-style: italic;
}
.figure {
  margin-top: 0;
  margin-bottom: 0;
  background: black;
  color: white;
  text-align: center;
  padding: 20px 0 10px 0;
}
.listing {
  background: #eee;
  font-size: 12px;
  padding-left: 10px;
}
.caption {
  margin-top: 5px;
  text-align: center;
  font-size: 10px;
  font-style: bold;
}
.footer {
  font-size: 10px;
  font-style: italic;
}
</style>
</head>
<body>
<h3>Open Source Common Lisp Software</h3>
<h1>S-BASE64</h1>
<h2>A Common Lisp implementation of Base64 Encoding/Decoding</h2>
<p>
<a href="http://homepage.mac.com/svc/s-base64/index.html">S-BASE64</a>
is an open source Common Lisp implementation of Base64 Encoding and Decoding.
Base64 encoding is a technique to encode binary data in a portable, safe printable, 7-bit ASCII format.
For a general introduction, please consult the <a href="http://en.wikipedia.org/wiki/Base64">Wikipedia article on Base64</a>.
This simple package is used as a building block in a number of other open source projects,
as can be seen from this description of some 
<a href="http://homepage.mac.com/svc/oscl.html">other Open Source Common Lisp packages</a>.
</p>
<h3>Contents</h3>
<ul>
<li><a href="#features">Features</a></li>
<li><a href="#status">Status</a></li>
<li><a href="#news">News</a></li>
<li><a href="#platforms">Platforms</a></li>
<li><a href="#downloading">Downloading</a></li>
<li><a href="#installation">Installation</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#api">API Reference</a></li>
<li><a href="#mailinglist">Mailinglist</a></li>
<li><a href="#changelog">Changelog</a></li>
<li><a href="#tod">TODO</a></li>
<li><a href="#faq">FAQ</a></li>
<li><a href="#bugs">Bugs</a></li>
<li><a href="#authors">Authors</a></li>
<li><a href="#maintainers">Maintainers</a></li>
<li><a href="#license">License</a></li>
<li><a href="#history">History</a></li>
<li><a href="#references">References</a></li>
</ul>
<h3 id="features">Features</h3>
<p>
S-BASE64 can:
</p>
<ul>
<li>convert a Base64 encoded character input stream into a decoded binary output stream</li>
<li>convert a binary output stream into a Base64 encoded character output stream</li>
<li>convert a Base64 encoded character input stream into a byte array</li>
<li>convert a byte array into a Base64 encoded character output stream</li>
<li>optionally break lines at 76 characters</li>
</ul> 
<h3 id="status">Status</h3>
<p>
S-BASE64 is considered stable code.
</p>
<h3 id="news">News</h3>
<p>
<em>October 2005</em> - Created as a seperate project.
</p>
<h3 id="platforms">Platforms</h3>
<p>
S-BASE64 is written in ANSI standard Common Lisp and should be portable across any CL implementation.
</p>
<h3 id="downloading">Downloading</h3>
<p>
You can download the latested released tarball of the S-BASE64 package from 
<a href="http://homepage.mac.com/svc/s-base64/s-base64.tar.gz">http://homepage.mac.com/svc/s-base64/s-base64.tar.gz</a>.
This archive is signed on release by <a href="http://homepage.mac.com/svc">Sven Van Caekenberghe</a>,
whose public key is published at
<a href="http://homepage.mac.com/svc/sven-public-ascii.gpg">http://homepage.mac.com/svc/sven-public-ascii.gpg</a>,
the signature is in 
<a href="http://homepage.mac.com/svc/s-base64/s-base64.tar.gz.asc">http://homepage.mac.com/svc/s-base64/s-base64.tar.gz.asc</a>.
</p>
<p>
Alternatively you can access the <a href="http://abridgegame.org/darcs/">DARCS</a> repository at
<a href="http://www.beta9.be/darcs/s-base64">http://www.beta9.be/darcs/s-base64</a>.
For a good description on how to use DARCS see
<a href="http://dirkgerrits.com/programming/erlisp/download/">http://dirkgerrits.com/programming/erlisp/download/</a>.
</p>
<div class="listing">
<pre>$ darcs get http://www.beta9.be/darcs/s-base64
Welcome to S-BASE64, a Common Lisp implementation of Base64 Encoding/Decoding
**********************
Copying patch 6 of 6... done!
Applying patches to the "working" directory...
............
Finished getting.
$ cd s-base64/
$ darcs pull
Pulling from "http://www.beta9.be/darcs/s-base64"...
Welcome to S-BASE64, a Common Lisp implementation of Base64 Encoding/Decoding
**********************
No remote changes to pull in!</pre>
</div>
<div class="caption">Example of basic darcs usage, get everything once and keep up to date by pulling in changes</div>
<h3 id="installation">Installation</h3>
<p>
The S-BASE64 package is loaded using <a href="http://www.cliki.net/asdf">ASDF</a>.
There is an excellent <a href="http://constantly.at/lisp/asdf/">tutorial on ASDF</a> to get you started. 
Alternatively you can use <a href="http://www.cliki.net/asdf-install">ASDF-INSTALL</a>.
There is an great <a href="http://weitz.de/asdf-install/">tutorial on ASDF-INSTALL</a> to get you on the way.
</p>
<div class="listing">
<pre>$ cd apps/asdf/systems/
$ ln -s ~/darcs/s-base64/s-base64.asd .
$ cd ~
$ /Applications/LispWorks/lispworks-tty 
LispWorks(R): The Common Lisp Programming Environment
Copyright (C) 1987-2005 LispWorks Ltd.  All rights reserved.
Version 4.4.5
Saved by sven as lispworks-tty, at 26 Oct 2005 11:53
User sven on voyager.local
; Loading text file /Applications/LispWorks/Library/lib/4-4-0-0/config/siteinit.lisp
;  Loading text file /Applications/LispWorks/Library/lib/4-4-0-0/private-patches/load.lisp
; Loading text file /Users/sven/.lispworks
;  Loading text file /Users/sven/apps/asdf/init-asdf.lisp
;   Loading fasl file /Users/sven/apps/asdf/asdf.nfasl
;Pushed #P"/Users/sven/apps/asdf/systems/" onto ASDF central registry

CL-USER 1 > (asdf:oos 'asdf:load-op :s-base64)
; Loading /Applications/LispWorks/Library/lib/4-4-0-0/load-on-demand/ccl/xp-fancyformat.nfasl on demand...
; loading system definition from
; /Users/sven/apps/asdf/systems/s-base64.asd into
; #&lt;The ASDF787 package, 0/16 internal, 0/16 external&gt;
; Loading text file /Users/sven/darcs/s-base64/s-base64.asd
; registering #<SYSTEM :S-BASE64 100B004B> as S-BASE64
;;; Compiling file /Users/sven/darcs/s-base64/src/package.lisp ...
...
; Loading fasl file /Users/sven/darcs/s-base64/src/package.nfasl
;;; Compiling file /Users/sven/darcs/s-base64/src/base64.lisp ...
...
; Loading fasl file /Users/sven/darcs/s-base64/src/base64.nfasl</pre>
</div>
<div class="caption">Example of setting up and using ASDF to compile and load the package</div>
<h3 id="usage">Usage</h3>
<p>
To encode you start with either a binary input stream or a byte array and write to a character output stream.
To decode you start from a character input stream and write to a binary output stream or return a byte array.
You can use the standard CL marcros WITH-OUTPUT-TO-STRING of WITH-INPUT-FROM-STRING to convert to and from a string.
The following listener transcript show how to compute the second example from RFC 3548, section 7:
</p>
<div class="listing">
<pre>CL-USER 1 > (in-package :s-base64)
#&lt;The S-BASE64 package, 50/128 internal, 4/16 external&gt;

S-BASE64 2 > (setf bytes #(#x14 #xfb #x9c #x03 #xd9))
#(20 251 156 3 217)

S-BASE64 3 > (with-output-to-string (out) 
               (encode-base64-bytes bytes out))
"FPucA9k="

S-BASE64 4 > (with-input-from-string (in *)
               (decode-base64-bytes in))
#(20 251 156 3 217)</pre>
</div>
<div class="caption">Example Base64 Encoding and Decoding</div>
<h3 id="api">API Reference</h3>
<p>
There is automatically generated <a href="API.html">API Reference</a> documentation available for the S-BASE64 package.
</p>
<h3 id="mailinglist">Mailinglist</h3>
<p>
The <a href="http://common-lisp.net/cgi-bin/mailman/listinfo/kpax-devel">KPAX mailing list</a> is used for this project.
</p>
<h3 id="changelog">Changelog</h3>
<p>
Release Notes:
</p>
<ul>
<li>release 1: moved S-BASE64 into a seperate project under a new structure</li>
</ul>
<h3 id="todo">TODO</h3>
<p>
There is a variant of Base64 encoding used for URL's and filenames that could be implemented.
</p>
<h3 id="faq">FAQ</h3>
<p>
Nothing appropriate.
</p>
<h3 id="bugs">Bugs</h3>
<p>
Illegal input results in generic low-level CL conditions rather than a more meaningful high-level application specific condition.
</p>
<h3 id="authors">Authors</h3>
<p>
S-BASE64 was written by <a href="http://homepage.mac.com/svc">Sven Van Caekenberghe</a>.
</p>
<h3 id="maintainers">Maintainers</h3>
<p>
S-BASE64 is being maintained by <a href="http://homepage.mac.com/svc">Sven Van Caekenberghe</a>.
</p>
<h3 id="license">License</h3>
<p>
You are granted the rights to distribute and use this software
as governed by the terms of the Lisp Lesser General Public License
(<a href="http://opensource.franz.com/preamble.html">http://opensource.franz.com/preamble.html</a>), 
also known as the LLGPL.
</p>
<h3 id="history">History</h3>
<p>
S-BASE64 was originally part of KPAX and became a seperate project in October 2005.
</p>
<h3 id="references">References</h3>
<p>
The following RFC's can be considered as definitions of Base64 Encoding:
<ul>
<li><a href="http://www.ietf.org/rfc/rfc1421.txt">RFC 1421</a></li>
<li><a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a></li>
<li><a href="http://www.ietf.org/rfc/rfc3548.txt">RFC 3548</a></li>
</ul>
</p>
<div class="footer">
Copyright &copy; 2002-2006 Sven Van Caekenberghe, Beta Nine BVBA. All Right Reserved. -
<a href="http://validator.w3.org/check/referer">This page is W3C Valid XHTML 1.0 Strict</a> -
<a href="http://www.anybrowser.org/campaign/">Viewable With Any Browser</a>
</div> 
</body>
</html>