Package org.drasyl.crypto
Class Hashing
- java.lang.Object
-
- org.drasyl.crypto.Hashing
-
public final class Hashing extends Object
Util class that provides hashing functions for drasyl.
-
-
Field Summary
Fields Modifier and Type Field Description static com.google.common.hash.HashFunction
MURMUR3_128
static com.google.common.hash.HashFunction
SHA256
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
hashCode2Hex(com.google.common.hash.HashCode code)
Converts the givenHashCode
into a hexadecimal string.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 String
sha256Hex(byte[] input)
Generates a SHA-256 hash of the given input.static String
sha256Hex(String input)
Generates a SHA-256 hash of the given input.
-
-
-
Method Detail
-
sha256Hex
public static String sha256Hex(String input)
Generates a SHA-256 hash of the given input.- Parameters:
input
- the input to hash- Returns:
- SHA-256 hash of the input
-
sha256Hex
public static String sha256Hex(byte[] input)
Generates a SHA-256 hash of the given input.- Parameters:
input
- the input to hash- Returns:
- SHA-256 hash of the input
-
hashCode2Hex
public static String hashCode2Hex(com.google.common.hash.HashCode code)
Converts the givenHashCode
into a hexadecimal string.- Parameters:
code
- the hash code to be converted- Returns:
- hexadecimal string representation of the hash code
-
murmur3x64Hex
public static String murmur3x64Hex(String input)
Generates a hexadecimal representation of the MurMur3x64 hash of the input.- Parameters:
input
- the input to hash- Returns:
- MurMur3x64 hash as hexadecimal string
-
murmur3x64Hex
public static String murmur3x64Hex(byte[] input)
Generates a hexadecimal representation of the MurMur3x64 hash of the input.- Parameters:
input
- the input to hash- Returns:
- MurMur3x64 hash as hexadecimal string
-
-