java.lang.Object
net.finmath.decryptionoracle.decryption.keys.Util

public class Util extends Object
Utilities related to encryption/decryption/hashing
Author:
Christian Fries
  • Constructor Details

    • Util

      public Util()
  • Method Details

    • getKeccak256Hashed

      public static byte[] getKeccak256Hashed(byte[] key)
      Generate a hash from a string.
      Parameters:
      key - The string.
      Returns:
      The hash.
    • getSha256Hashed

      public static byte[] getSha256Hashed(byte[] data)
      SHA-256 hash, as Hex-String (UTF-8 bytes).
    • getRIPEMD160Hashed

      public static byte[] getRIPEMD160Hashed(byte[] bytes)
    • getHex

      public static String getHex(byte[] bytes)

      getHex.

      Parameters:
      bytes - an array of bytes objects
      Returns:
      a String object
    • getHexTrimmed

      public static String getHexTrimmed(byte[] bytes)

      getHexTrimmed.

      Parameters:
      bytes - an array of bytes objects
      Returns:
      a String object
    • getHexTrimmed

      public static String getHexTrimmed(byte[] bytes, int len)

      getHexTrimmed.

      Parameters:
      bytes - an array of bytes objects
      len - a int
      Returns:
      a String object
    • getBase64

      public static String getBase64(byte[] bytes)

      getBase64.

      Parameters:
      bytes - an array of bytes objects
      Returns:
      a String object
    • Keccak256Digest

      public static byte[] Keccak256Digest(byte[] input)

      Keccak256Digest.

      Parameters:
      input - an array of bytes objects
      Returns:
      an array of bytes objects
    • generateRandomSecret

      public static byte[] generateRandomSecret()
      Generate a random secrete (base64 encoded).
      Returns:
      A string representing a random secret.
    • publicKeyFromPath

      public static PublicKey publicKeyFromPath(Path path)

      publicKeyFromPath.

      Parameters:
      path - a Path object
      Returns:
      a PublicKey object
    • privateKeyFromPath

      public static PrivateKey privateKeyFromPath(Path path)

      privateKeyFromPath.

      Parameters:
      path - a Path object
      Returns:
      a PrivateKey object
    • strip0x

      public static String strip0x(String s)
    • toHexBytes

      public static byte[] toHexBytes(byte[] plain)
    • hexToBytes

      public static byte[] hexToBytes(String hex)
    • bytesToHex

      public static String bytesToHex(byte[] data)