HexTranslator (Bouncy Castle Library 1.85 API Specification)
Date: 2026-07-12

org.bouncycastle.util.encoders

## Class HexTranslator

- java.lang.Object
- - org.bouncycastle.util.encoders.HexTranslator

- All Implemented Interfaces:
    Translator

      public class HexTranslator
      extends java.lang.Object
      implements Translator

  Converters for going from hex to binary and back. Note: this class assumes ASCII processing.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HexTranslator()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `decode(byte[] in, int inOff, int length, byte[] out, int outOff)`
    `int` | `encode(byte[] in, int inOff, int length, byte[] out, int outOff)`
    `int` | `getDecodedBlockSize()` size of the output block on decoding produced by getEncodedBlockSize() bytes.
    `int` | `getEncodedBlockSize()` size of the output block on encoding produced by getDecodedBlockSize() bytes.

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

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

- - ### Constructor Detail

    - #### HexTranslator

          public HexTranslator()

  - ### Method Detail

    - #### getEncodedBlockSize

          public int getEncodedBlockSize()

      size of the output block on encoding produced by getDecodedBlockSize() bytes.
      Specified by:
        `getEncodedBlockSize` in interface `Translator`

    - #### encode

          public int encode(byte[] in,
                            int inOff,
                            int length,
                            byte[] out,
                            int outOff)

      Specified by:
        `encode` in interface `Translator`

    - #### getDecodedBlockSize

          public int getDecodedBlockSize()

      size of the output block on decoding produced by getEncodedBlockSize() bytes.
      Specified by:
        `getDecodedBlockSize` in interface `Translator`

    - #### decode

          public int decode(byte[] in,
                            int inOff,
                            int length,
                            byte[] out,
                            int outOff)

      Specified by:
        `decode` in interface `Translator`