Class SRP6.Salt

java.lang.Object
br.net.dd.netherwingcore.common.cryptography.authentication.SRP6.Salt
Enclosing class:
SRP6

public static class SRP6.Salt extends Object
Represents a fixed-length salt used in SRP computations. The salt is critical for protecting against brute-force attacks by being incorporated into hash calculations.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a Salt instance by generating random bytes of a fixed length.
    Salt(byte[] value)
    Constructs a Salt instance using a provided fixed-length byte array.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Returns the value of the salt as a byte array.
    Converts the salt value into a hexadecimal string representation.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • Salt

      public Salt(byte[] value)
      Constructs a Salt instance using a provided fixed-length byte array.
      Parameters:
      value - A byte array of exactly 32 bytes.
      Throws:
      IllegalArgumentException - if the provided byte array is not of the required length.
    • Salt

      public Salt()
      Constructs a Salt instance by generating random bytes of a fixed length. Uses a secure random number generator.
  • Method Details

    • getValue

      public byte[] getValue()
      Returns the value of the salt as a byte array.
      Returns:
      A copy of the internal salt byte array.
    • toString

      public String toString()
      Converts the salt value into a hexadecimal string representation.
      Overrides:
      toString in class Object
      Returns:
      A hexadecimal representation of the salt.