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 final com.google.common.hash.HashFunction
     
    static final com.google.common.hash.HashFunction
     
    static final com.google.common.hash.HashFunction
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    hashCode2Hex(com.google.common.hash.HashCode code)
    Converts the given HashCode 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
    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
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      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 given HashCode 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
    • murmur3x32Hex

      public static String murmur3x32Hex(String input)
      Generates a hexadecimal representation of the MurMur3x32 hash of the input.
      Parameters:
      input - the input to hash
      Returns:
      MurMur3x32 hash as hexadecimal string
    • murmur3x32Hex

      public static String murmur3x32Hex(byte[] input)
      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