INNER CODE UNIT · Kotlin
pwHashStep2
terl/lazysodium-java · sample-app/src/main/kotlin/Main.kt:288
private fun pwHashStep2() {
val pw = "lol"
printStep(
"2",
"Multiple password verification (Native)",
("Verifying password '" + pw + "' using Argon2 many times. " +
"This may take a while...")
)
val pwBytes: ByteArray = lazySodium.bytes(pw)
// Remember the terminating byte (null byte) at the end of the hash!
// As this is using the Native interface you must always remember
// to add that null byte yourself. Use the Lazy interface if you
// don't want to handle any of that (as shown in the next step).
val hash: ByteArray = lazySodium.bytes(
"\$argon2id\$v=19\$m=65536,t=2,p=1\$ZrWMVZiMs4tvs0QwVc7T7A\$L" +
"Il6XlgIZsuozRpC3bCe5ew8LEWgDQvQE8qwsZ9ISps\u0000"
)