Class CodecUtils

java.lang.Object
io.mangoo.utils.CodecUtils

public final class CodecUtils extends Object
Author:
svenkubiak
  • Method Details

    • hashArgon2

      public static String hashArgon2(String password, String salt)
      Hashes a given clear text password with salt using Argon2Id password hashing
      Parameters:
      password - The clear text password
      salt - The salt
      Returns:
      The hashed password
    • matchArgon2

      public static boolean matchArgon2(String password, String salt, String hashedPassword)
      Matches a given clear text password with salt using Argon2Id against an already Argon2Id hashed password
      Parameters:
      password - The clear text password
      salt - The salt
      hashedPassword - The already hashed password
      Returns:
      True if hashes match, false otherwise
    • hexSHA512

      public static String hexSHA512(String data)
      Hashes a given clear text data with SHA512 For simple hashing tasks Use hashArgon2 for password hashing
      Parameters:
      data - The clear text data
      Returns:
      SHA512 hashed value
    • serializeToBase64

      public static String serializeToBase64(Serializable object)
      Serializes an object into a Base64 encoded data string
      Parameters:
      object - The object to serialize
      Returns:
      The base64 encoded data string
    • deserializeFromBase64

      public static <T> T deserializeFromBase64(String data)
      Deserializes a given Base64 encoded data string into an object
      Type Parameters:
      T - Just for JavaDoc can be ignored
      Parameters:
      data - The base64 encoded data string
      Returns:
      The required object