INNER CODE UNIT · Kotlin
pwHashStep1
terl/lazysodium-java · sample-app/src/main/kotlin/Main.kt:266
private fun pwHashStep1() {
printSection("Running password hashing")
val pw = "superAwesomePassword"
printStep(
"1",
"Hashing a password",
"Attempting to hash a password '$pw' using Argon 2."
)
try {
val hash: String = lazySodium.cryptoPwHashStr(pw, 2L, NativeLong(65536))
log()
logt("Password hashing successful: $hash")
log()
} catch (e: SodiumException) {
e.printStackTrace()
log()
logt("Password hashing failed with exception: " + e.message)
log()