tests/pw_hash.R

library(argon2)

test.hash = function(hash, pass)
{
  stopifnot(pw_check(hash, pass))
  stopifnot(!pw_check(hash, "password"))
}

set.seed(1234)
pass = "myPassw0rd!"

hash = pw_hash(pass, variant="i", iterations=5, memory=2, nthreads=1)
test.hash(hash, pass)

hash = pw_hash(pass, variant="i", iterations=10, memory=4, nthreads=1)
test.hash(hash, pass)



hash = pw_hash(pass, variant="d", iterations=5, memory=2, nthreads=1)
test.hash(hash, pass)

hash = pw_hash(pass, variant="d", iterations=10, memory=4, nthreads=1)
test.hash(hash, pass)

Try the argon2 package in your browser

Any scripts or data that you put into this service are public.

argon2 documentation built on Oct. 31, 2021, 1:06 a.m.