Record Class PasswordHash
java.lang.Object
java.lang.Record
com.svenruppert.jsentinel.authentication.PasswordHash
- Record Components:
algorithm- algorithm identifier (e.g.pbkdf2)encoded- base64-encoded hash bytes (without padding)parameters- algorithm-specific parameters required to re-derive the hash from a candidate password (e.g. iteration count, salt). TheMapis defensively copied soPasswordHashis fully immutable.
public record PasswordHash(String algorithm, String encoded, Map<String,String> parameters)
extends Record
Typed representation of a stored password hash.
Used by the PasswordHasher.hashTo(char[]) /
PasswordHasher.verify(char[], PasswordHash) /
PasswordHasher.needsRehash(PasswordHash) API. The hasher
implementation owns the wire format used by the legacy
PasswordHasher.hash(char[]) / PasswordHasher.verify(char[], String)
methods — see Pbkdf2PasswordHasher.parse(String) and
Pbkdf2PasswordHasher.serialize(PasswordHash) for the round-trip.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thealgorithmrecord component.encoded()Returns the value of theencodedrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intintParameter(String key, int defaultValue) Convenience reader for a numeric parameter — returns the parsed value ordefaultValueif the key is missing or unparseable.Returns the value of theparametersrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PasswordHash
Creates an instance of aPasswordHashrecord class.- Parameters:
algorithm- the value for thealgorithmrecord componentencoded- the value for theencodedrecord componentparameters- the value for theparametersrecord component
-
-
Method Details
-
intParameter
Convenience reader for a numeric parameter — returns the parsed value ordefaultValueif the key is missing or unparseable.- Parameters:
key- parameter namedefaultValue- fallback when missing/invalid- Returns:
- parsed integer
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
algorithm
-
encoded
-
parameters
Returns the value of theparametersrecord component.- Returns:
- the value of the
parametersrecord component
-