Apache Commons logo Apache Commons Codec

User guide

Codec consists of a set of utilities and a simple framework for encoding and decoding text and binary data.

Binary Encoders

Interfaces and classes used by the various implementations in the sub-packages.

Base32 Provides Base32 encoding and decoding as defined by RFC 4648
Base32InputStream Provides Base32 encoding and decoding in a streaming fashion (unlimited size).
Base64 Provides Base64 encoding and decoding as defined by RFC 2045
Base64InputStream Provides Base64 encoding and decoding in a streaming fashion (unlimited size).
BinaryCodec Converts between byte arrays and strings of "0"s and "1"s.
Hex Converts hexadecimal Strings.

Digest Encoders

WARNING: Some of the functions in this package might not be suitable for cryptography, or are no longer cryptographically-secure.

Blake3 Provides a pure Java implementation of the Blake3 hash function which can be used for computing cryptographic hashes (message digests) which are extensible to arbitrary output lengths (known as an extensible-output function or XOF), computing message authentication codes using a 32 byte (256-bit) secret key, computing subkeys from a primary key using a key derivation function, and can be used as the basis for a cryptographically-secure pseudorandom number generator.
WARNING: Blake3 is not a password hashing algorithm! An algorithm such as Argon2 is more appropriate for password hashing.
Crypt GNU libc crypt(3) compatible hash method.
DigestUtils Simplifies common MessageDigest tasks and provides GNU libc crypt(3) compatible password hashing functions.
HmacUtils Simplifies common Mac tasks.
Note: Not all JCE implementations support all algorithms. If not supported, an IllegalArgumentException is thrown.
Md5Crypt The libc crypt() "$1$" and Apache "$apr1$" MD5-based hash algorithm.
MurmurHash2 Implementation of the MurmurHash2 32-bit and 64-bit hash functions.
MurmurHash3 Implementation of the MurmurHash3 32-bit and 128-bit hash functions.
PureJavaCrc32 A pure-java implementation of the CRC32 checksum that uses the same polynomial as the built-in native CRC32.
PureJavaCrc32C A pure-java implementation of the CRC32 checksum that uses the CRC32-C polynomial, the same polynomial used by iSCSI and implemented on many Intel chipsets supporting SSE 4.2.
Sha2Crypt SHA2-based Unix crypt implementation.
UnixCrypt Unix crypt(3) algorithm implementation. This class only implements the traditional 56 bit DES based algorithm.
XXHash32 Implementation of the xxHash32 hash algorithm.

Language Encoders

Caverphone 1.0 Encodes a string into a Caverphone 1.0 value.
Caverphone 2.0 Encodes a string into a Caverphone 2.0 value.
Cologne Phonetic Encodes a string into a Cologne Phonetic value.
Double Metaphone Encodes a string into a double metaphone value.
Metaphone Encodes a string into a Metaphone value.
Refined Soundex Encodes a string into a Refined Soundex value.
Soundex Encodes a string into a Soundex value.

Network Encoders

BCodec Identical to the Base64 encoding defined by RFC 1521 and allows a character set to be specified.
PercentCodec Implements the Percent-Encoding scheme, as described in HTTP 1.1 specification.
QCodec Similar to the Quoted-Printable content-transfer-encoding defined in RFC 1521 and designed to allow text containing mostly ASCII characters to be decipherable on an ASCII terminal without decoding.
QuotedPrintableCodec Codec for the Quoted-Printable section of RFC 1521 .
URLCodec Implements the www-form-urlencoded encoding scheme, also misleadingly known as URL encoding.