Class Util
java.lang.Object
net.finmath.decryptionoracle.decryption.keys.Util
Utilities related to encryption/decryption/hashing
- Author:
- Christian Fries
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbytesToHex(byte[] data) static byte[]Generate a random secrete (base64 encoded).static StringgetBase64(byte[] bytes) getBase64.static StringgetHex(byte[] bytes) getHex.static StringgetHexTrimmed(byte[] bytes) getHexTrimmed.static StringgetHexTrimmed(byte[] bytes, int len) getHexTrimmed.static byte[]getKeccak256Hashed(byte[] key) Generate a hash from a string.static byte[]getRIPEMD160Hashed(byte[] bytes) static byte[]getSha256Hashed(byte[] data) SHA-256 hash, as Hex-String (UTF-8 bytes).static byte[]hexToBytes(String hex) static byte[]Keccak256Digest(byte[] input) Keccak256Digest.static PrivateKeyprivateKeyFromPath(Path path) privateKeyFromPath.static PublicKeypublicKeyFromPath(Path path) publicKeyFromPath.static Stringstatic byte[]toHexBytes(byte[] plain)
-
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
getHex.
- Parameters:
bytes- an array of bytes objects- Returns:
- a
Stringobject
-
getHexTrimmed
getHexTrimmed.
- Parameters:
bytes- an array of bytes objects- Returns:
- a
Stringobject
-
getHexTrimmed
getHexTrimmed.
- Parameters:
bytes- an array of bytes objectslen- a int- Returns:
- a
Stringobject
-
getBase64
getBase64.
- Parameters:
bytes- an array of bytes objects- Returns:
- a
Stringobject
-
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
publicKeyFromPath.
-
privateKeyFromPath
privateKeyFromPath.
- Parameters:
path- aPathobject- Returns:
- a
PrivateKeyobject
-
strip0x
-
toHexBytes
public static byte[] toHexBytes(byte[] plain) -
hexToBytes
-
bytesToHex
-