title: Base64 encoding vs Ascii85 encoding
body: <p>My project at work is using the <a href="http://jackson.codehaus.org" rel="noreferrer">Jackson JSON</a> serializer to convert a bunch of Java objects into Strings in order to send them to REST services.</p>
  
  <p>Some of these objects contain sensitive data, so I've written custom serializers to serialize these objects to JSON strings, then gzip them, then encrypt them using <code>AES</code>; </p>
  
  <p>This turns the strings into byte arrays, so I use the <a href="http://en.wikipedia.org/wiki/Base64" rel="noreferrer">Base64</a> encoder in <code>Apache commons</code> codec to convert the byte arrays into strings.  The custom deserializers behind the REST interfaces reverse this process: </p>
  
  <p><code>base64 decode -&gt; decrypt -&gt; decompress -&gt; deserialize using default Jackson deserializer.</code></p>
  
  <p><code>Base64</code> encoding increases the size of the output (the gzip step in serialization is meant to help ameliorate this increase), so I checked Google to see if there was a more efficient alternative, which led me to <a href="https://stackoverflow.com/questions/1777309/alternative-to-base64-encoding">this</a> previous stackoverflow thread that brought up <a href="http://en.wikipedia.org/wiki/Ascii85" rel="noreferrer">Ascii85</a> encoding as a more efficient alternative - </p>
  
  <p><code>Base64</code> adds 33% to the size of the output, <code>Ascii85</code> adds 25% to the size of the output.  </p>
  
  <p>I found a few Java Ascii85 implementations e.g. Apache pdfbox, but I'm a bit leery to use the encoding - it seems like hardly anybody is using or implementing it, which might just mean that Base64 has more inertia, or which may instead mean that there's some wonky problem with Ascii85.  </p>
  
  <p>Does anybody know more on this subject?  Are there any problems with Ascii85 that mean that I should use Base64 instead?</p>