tuweni / org.apache.tuweni.crypto.sodium / PasswordHash / hash

hash

static fun hash(password: String!, length: Int, salt: Salt!): Bytes! (source)

Compute a key from a password, using the currently recommended algorithm and limits on operations and memory that are suitable for most use-cases.

Parameters

password - String!: The password to hash.

length - Int: The key length to generate.

salt - Salt!: A salt.

Return
Bytes!: The derived key.

static fun hash(password: Bytes!, length: Int, salt: Salt!): Bytes! (source)

Compute a key from a password, using the currently recommended algorithm and limits on operations and memory that are suitable for most use-cases.

Parameters

password - Bytes!: The password to hash.

length - Int: The key length to generate.

salt - Salt!: A salt.

Return
Bytes!: The derived key.

static fun hash(password: ByteArray!, length: Int, salt: Salt!): ByteArray! (source)

Compute a key from a password, using the currently recommended algorithm and limits on operations and memory that are suitable for most use-cases.

Parameters

password - ByteArray!: The password to hash.

length - Int: The key length to generate.

salt - Salt!: A salt.

Return
ByteArray!: The derived key.

static fun hash(password: String!, length: Int, salt: Salt!, algorithm: Algorithm!): Bytes! (source)

Compute a key from a password, using limits on operations and memory that are suitable for most use-cases.

Parameters

password - String!: The password to hash.

length - Int: The key length to generate.

salt - Salt!: A salt.

algorithm - Algorithm!: The algorithm to use.

Return
Bytes!: The derived key.

static fun hash(password: Bytes!, length: Int, salt: Salt!, algorithm: Algorithm!): Bytes! (source)

Compute a key from a password, using limits on operations and memory that are suitable for most use-cases.

Parameters

password - Bytes!: The password to hash.

length - Int: The key length to generate.

salt - Salt!: A salt.

algorithm - Algorithm!: The algorithm to use.

Return
Bytes!: The derived key.

static fun hash(password: ByteArray!, length: Int, salt: Salt!, algorithm: Algorithm!): ByteArray! (source)

Compute a key from a password, using limits on operations and memory that are suitable for most use-cases.

Parameters

password - ByteArray!: The password to hash.

length - Int: The key length to generate.

salt - Salt!: A salt.

algorithm - Algorithm!: The algorithm to use.

Return
ByteArray!: The derived key.

static fun hash(password: String!, length: Int, salt: Salt!, opsLimit: Long, memLimit: Long, algorithm: Algorithm!): Bytes! (source)

Compute a key from a password.

Parameters

password - String!: The password to hash.

length - Int: The key length to generate.

salt - Salt!: A salt.

opsLimit - Long: The operations limit, which must be in the range #minOpsLimit() to #maxOpsLimit().

memLimit - Long: The memory limit, which must be in the range #minMemLimit() to #maxMemLimit().

algorithm - Algorithm!: The algorithm to use.

Return
Bytes!: The derived key.

static fun hash(password: Bytes!, length: Int, salt: Salt!, opsLimit: Long, memLimit: Long, algorithm: Algorithm!): Bytes! (source)

Compute a key from a password.

Parameters

password - Bytes!: The password to hash.

length - Int: The key length to generate.

salt - Salt!: A salt.

opsLimit - Long: The operations limit, which must be in the range #minOpsLimit() to #maxOpsLimit().

memLimit - Long: The memory limit, which must be in the range #minMemLimit() to #maxMemLimit().

algorithm - Algorithm!: The algorithm to use.

Return
Bytes!: The derived key.

static fun hash(password: ByteArray!, length: Int, salt: Salt!, opsLimit: Long, memLimit: Long, algorithm: Algorithm!): ByteArray! (source)

Compute a key from a password.

Parameters

password - ByteArray!: The password to hash.

length - Int: The key length to generate.

salt - Salt!: A salt.

opsLimit - Long: The operations limit, which must be in the range #minOpsLimit() to #maxOpsLimit().

memLimit - Long: The memory limit, which must be in the range #minMemLimit() to #maxMemLimit().

algorithm - Algorithm!: The algorithm to use.

Exceptions

IllegalArgumentException - If the opsLimit is too low for the specified algorithm.

UnsupportedOperationException - If the specified algorithm is not supported by the currently loaded sodium native library.

Return
ByteArray!: The derived key.

static fun hash(password: String!): String! (source)

Compute a hash from a password, using limits on operations and memory that are suitable for most use-cases.

Equivalent to hash(password, moderateOpsLimit(), moderateMemLimit()).

Parameters

password - String!: The password to hash.

Return
String!: The hash string.

static fun hash(password: String!, opsLimit: Long, memLimit: Long): String! (source)

Compute a hash from a password.

Parameters

password - String!: The password to hash.

opsLimit - Long: The operations limit, which must be in the range #minOpsLimit() to #maxOpsLimit().

memLimit - Long: The memory limit, which must be in the range #minMemLimit() to #maxMemLimit().

Return
String!: The hash string.