Skip to content

Instantly share code, notes, and snippets.

View markov's full-sized avatar

Gesh Markov markov

  • Google
  • Hamburg, DE
  • 15:21 (UTC +01:00)
View GitHub Profile
@markov
markov / CrockfordBase32.java
Created March 20, 2013 16:56
Crockford Base32 Encoder and Decoder written in Java. It is a shameless adaptation of the Base32 encoder from apache commons-condec. I would have loved to just extend from their BaseNCodec class, but alas it is not designed for extension...
import java.nio.charset.Charset;
/**
* <p>Provides Base32 encoding and decoding as defined by <a href="http://www.ietf.org/rfc/rfc4648.txt">RFC 4648</a>.
* However it uses a custom alphabet first coined by Douglas Crockford. Only addition to the alphabet is that 'u' and
* 'U' characters decode as if they were 'V' to improve mistakes by human input.<p/>
* <p>
* This class operates directly on byte streams, and not character streams.
* </p>
*