Class HexaDecimal

java.lang.Object
org.webpki.util.HexaDecimal

public class HexaDecimal extends Object
Encodes/decodes hexadecimal data.
  • Method Details

    • encodeDebugData

      public static String encodeDebugData(byte[] byteArray, int bytesPerLine)
      Encode byte array into readable lines.

      After each line (nn: hh hh...) the ASCII counterpart is listed as well.

      Parameters:
      byteArray - The data to be listed
      bytesPerLine - Bytes per line
      Returns:
      Human-readable String
    • encode

      public static String encode(byte[] byteArray)
      Encode byte array.
      Parameters:
      byteArray - Data to be encoded
      Returns:
      String with zero or more hexadecimal pairs (hh)
    • decode

      public static byte[] decode(String hexString)
      Decode hexadecimal string.
      Parameters:
      hexString - String with zero or more hexadecimal pairs (hh)
      Returns:
      Decoded data as a byte array
      Throws:
      IllegalArgumentException