Package org.drasyl.crypto
Class Hashing
java.lang.Object
org.drasyl.crypto.Hashing
Util class that provides hashing functions for drasyl.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.google.common.hash.HashFunction
static final com.google.common.hash.HashFunction
static final com.google.common.hash.HashFunction
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
hashCode2Hex
(com.google.common.hash.HashCode code) Converts the givenHashCode
into a hexadecimal string.static byte[]
murmur3x32
(byte[]... input) Generates a MurMur3x32 hash of the input.static String
murmur3x32Hex
(byte[] input) Generates a hexadecimal representation of the MurMur3x32 hash of the input.static String
murmur3x32Hex
(String input) Generates a hexadecimal representation of the MurMur3x32 hash of the input.static String
murmur3x64Hex
(byte[] input) Generates a hexadecimal representation of the MurMur3x64 hash of the input.static String
murmur3x64Hex
(String input) Generates a hexadecimal representation of the MurMur3x64 hash of the input.static byte[]
sha256
(byte[]... input) Generates a SHA-256 hash of the given input.static String
sha256Hex
(byte[] input) Generates a SHA-256 hash of the given input.static String
Generates a SHA-256 hash of the given input.
-
Field Details
-
MURMUR3_128
public static final com.google.common.hash.HashFunction MURMUR3_128 -
SHA256
public static final com.google.common.hash.HashFunction SHA256 -
MURMUR3_32
public static final com.google.common.hash.HashFunction MURMUR3_32
-
-
Method Details
-
sha256
public static byte[] sha256(byte[]... input) Generates a SHA-256 hash of the given input.- Parameters:
input
- the input to hash- Returns:
- SHA-256 hash of the input
-
sha256Hex
Generates a SHA-256 hash of the given input.- Parameters:
input
- the input to hash- Returns:
- SHA-256 hash of the input
-
sha256Hex
Generates a SHA-256 hash of the given input.- Parameters:
input
- the input to hash- Returns:
- SHA-256 hash of the input
-
hashCode2Hex
Converts the givenHashCode
into a hexadecimal string.- Parameters:
code
- the hash code to be converted- Returns:
- hexadecimal string representation of the hash code
-
murmur3x64Hex
Generates a hexadecimal representation of the MurMur3x64 hash of the input.- Parameters:
input
- the input to hash- Returns:
- MurMur3x64 hash as hexadecimal string
-
murmur3x64Hex
Generates a hexadecimal representation of the MurMur3x64 hash of the input.- Parameters:
input
- the input to hash- Returns:
- MurMur3x64 hash as hexadecimal string
-
murmur3x32Hex
Generates a hexadecimal representation of the MurMur3x32 hash of the input.- Parameters:
input
- the input to hash- Returns:
- MurMur3x32 hash as hexadecimal string
-
murmur3x32Hex
Generates a hexadecimal representation of the MurMur3x32 hash of the input.- Parameters:
input
- the input to hash- Returns:
- MurMur3x32 hash as hexadecimal string
-
murmur3x32
public static byte[] murmur3x32(byte[]... input) Generates a MurMur3x32 hash of the input.- Parameters:
input
- the input to hash- Returns:
- MurMur3x32 hash
-