Class HashFunctions

java.lang.Object
org.episteme.core.mathematics.cryptography.HashFunctions

public class HashFunctions extends Object
Cryptographic hash functions.

One-way functions for data integrity, digital signatures, password hashing.

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Constructor Details

    • HashFunctions

      public HashFunctions()
  • Method Details

    • sha256

      public static byte[] sha256(byte[] data)
      SHA-256 hash function.

      Produces 256-bit (32-byte) hash. Collision-resistant.

    • sha256

      public static String sha256(String text)
      SHA-256 for strings.
    • sha512

      public static byte[] sha512(byte[] data)
      SHA-512 hash function.
    • sha512

      public static String sha512(String text)
      SHA-512 for strings.
    • hmacSha256

      public static byte[] hmacSha256(byte[] key, byte[] data)
      HMAC-SHA256 (keyed hash for message authentication).
    • pbkdf2

      public static byte[] pbkdf2(String password, byte[] salt, int iterations)
      bcrypt-like password hashing (using PBKDF2).

      Slow by design to resist brute-force attacks.

    • constantTimeEquals

      public static boolean constantTimeEquals(byte[] a, byte[] b)
      Constant-time comparison to prevent timing attacks.