Argon2

class Argon2

Provides utilities for password hashing and verification using the Argon2 algorithm (ARGON2id variant).

Argon2 is a memory-hard password-hashing function designed to resist brute-force attacks. This implementation uses the Bouncy Castle library and provides methods for generating salts, hashing passwords, and verifying hashes. It uses predefined parameters for iterations, memory limit, parallelism, and hash length to balance security and performance.

The Companion object contains static methods for hashing and verification, along with extension functions for convenient use with String and ByteArray. The Result class encapsulates the hash and salt for easy handling.

See also

for HMAC-SHA256-based message authentication

for the random number generator used for salt generation

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion
Link copied to clipboard
class Result(val hash: ByteArray, val salt: ByteArray)

Encapsulates the result of an Argon2 hashing operation, containing the hash and the salt used.