Base58 (Apache Commons Codec 1.22.0 API)
Description: declaration: package: org.apache.commons.codec.binary, class: Base58

Package org.apache.commons.codec.binary

# Class Base58

java.lang.Object
org.apache.commons.codec.binary.BaseNCodec
org.apache.commons.codec.binary.Base58

All Implemented Interfaces:
  `BinaryDecoder`, `BinaryEncoder`, `Decoder`, `Encoder`

public class Base58 extends BaseNCodec
Provides Base58 encoding and decoding as commonly used in cryptocurrency and blockchain applications.

Base58 is a binary-to-text encoding scheme that uses a 58-character alphabet to encode data. It avoids characters that can be confused (0/O, I/l, +/) and is commonly used in Bitcoin and other blockchain systems.

This implementation accumulates data internally until EOF is signaled, at which point the entire input is converted using BigInteger arithmetic. This is necessary because Base58 encoding/decoding requires access to the complete data to properly handle leading zeros.

This class is thread-safe for read operations but the Context object used during encoding/decoding should not be shared between threads.

The Base58 alphabet is:

     123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz

This excludes: `0`, `I`, `O`, and `l`.

Since:
  1.22.0
See Also:
  - `Base58InputStream`
  - `Base58OutputStream`
  - The Base58 Encoding Scheme draft-msporny-base58-03

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `Base58.Builder`
  Builds `Base58` instances with custom configuration.

  ## Nested classes/interfaces inherited from class org.apache.commons.codec.binary.BaseNCodec

  `BaseNCodec.AbstractBuilder<T,B extends BaseNCodec.AbstractBuilder<T,B>>`

- ## Field Summary

  ### Fields inherited from class org.apache.commons.codec.binary.BaseNCodec

  `DECODING_POLICY_DEFAULT, lineLength, MASK_8BITS, MIME_CHUNK_SIZE, pad, PAD, PAD_DEFAULT, PEM_CHUNK_SIZE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Base58()`
  Constructs a Base58 codec used for encoding and decoding.
  `Base58(Base58.Builder builder)`
  Constructs a Base58 codec used for encoding and decoding with custom configuration.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Base58.Builder`
  `builder()`
  Creates a new Builder.
  `protected boolean`
  `isInAlphabet(byte value)`
  Returns whether or not the `octet` is in the Base58 alphabet.

  ### Methods inherited from class org.apache.commons.codec.binary.BaseNCodec

  `containsAlphabetOrPad, decode, decode, decode, encode, encode, encode, encodeAsString, encodeToString, ensureBufferSize, getChunkSeparator, getCodecPolicy, getDefaultBufferSize, getEncodedLength, isInAlphabet, isInAlphabet, isStrictDecoding, isWhiteSpace`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Base58

    public Base58()
    Constructs a Base58 codec used for encoding and decoding.

  - ### Base58

    public Base58(Base58.Builder builder)
    Constructs a Base58 codec used for encoding and decoding with custom configuration.
    Parameters:
      `builder` - the builder with custom configuration.

- ## Method Details

  - ### builder

    public static Base58.Builder builder()
    Creates a new Builder.

    To configure a new instance, use a `Base58.Builder`. For example:

         Base58 base58 = Base58.builder()
           .setEncode(true)
           .get()

    Returns:
      a new Builder.

  - ### isInAlphabet

    protected boolean isInAlphabet(byte value)
    Returns whether or not the `octet` is in the Base58 alphabet.
    Specified by:
      `isInAlphabet` in class `BaseNCodec`
    Parameters:
      `value` - The value to test.
    Returns:
      `true` if the value is defined in the Base58 alphabet `false` otherwise.