Package co.cryptoservice.sdk
Record Class PasswordHashResult
java.lang.Object
java.lang.Record
co.cryptoservice.sdk.PasswordHashResult
- Record Components:
algorithm- password hashing algorithmhash- the 32-byte Argon2id hash; lowercase hexparams- argon2id parameters; pass them back to verifyphc- the same hash as a PHC string ($argon2id$v=19$m=..,t=..,p=..$salt$hash, unpadded base64 fields)salt- the random 16-byte salt; lowercase hex
public record PasswordHashResult(String algorithm, String hash, Argon2Params params, String phc, String salt)
extends Record
What
POST /v2/password/hash answers: hash a password with Argon2id.-
Constructor Summary
ConstructorsConstructorDescriptionPasswordHashResult(String algorithm, String hash, Argon2Params params, String phc, String salt) Creates an instance of aPasswordHashResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thealgorithmrecord component.final booleanIndicates whether some other object is "equal to" this one.hash()Returns the value of thehashrecord component.byte[]hash()decoded from hex.final inthashCode()Returns a hash code value for this object.params()Returns the value of theparamsrecord component.phc()Returns the value of thephcrecord component.salt()Returns the value of thesaltrecord component.byte[]salt()decoded from hex.toString()Names the members; values that may be secret (keys, plaintexts, passwords, signatures) are redacted.
-
Constructor Details
-
PasswordHashResult
public PasswordHashResult(String algorithm, String hash, Argon2Params params, String phc, String salt) Creates an instance of aPasswordHashResultrecord class.
-
-
Method Details
-
hashBytes
public byte[] hashBytes()hash()decoded from hex.- Returns:
- the bytes, or null when
hashis absent - Throws:
IllegalArgumentException- when the server sent malformed hex
-
saltBytes
public byte[] saltBytes()salt()decoded from hex.- Returns:
- the bytes, or null when
saltis absent - Throws:
IllegalArgumentException- when the server sent malformed hex
-
toString
Names the members; values that may be secret (keys, plaintexts, passwords, signatures) are redacted. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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
Returns the value of thealgorithmrecord component.- Returns:
- the value of the
algorithmrecord component
-
hash
Returns the value of thehashrecord component.- Returns:
- the value of the
hashrecord component
-
params
Returns the value of theparamsrecord component.- Returns:
- the value of the
paramsrecord component
-
phc
Returns the value of thephcrecord component.- Returns:
- the value of the
phcrecord component
-
salt
Returns the value of thesaltrecord component.- Returns:
- the value of the
saltrecord component
-