password: Password Storage

Password storageR Documentation

Password Storage

Description

Wrapper that implements best practices for storing passwords based on scrypt with a random salt.

Usage

password_store(password)

password_verify(hash, password)

Arguments

password

a string of length one with a password

hash

a hash string of length one generated by password_store

Details

The password_store function returns an ASCII encoded string which contains the result of a memory-hard, CPU-intensive hash function along with the automatically generated salt and other parameters required to verify the password. Use password_verify to verify a password from this string.

References

https://doc.libsodium.org/password_hashing/

Examples

# Example password
password <- "I like cookies"

# Hash is what you store in the database
hash <- password_store(password)

# To verify the password when the user logs in
stopifnot(password_verify(hash, password))

sodium documentation built on Nov. 20, 2023, 5:06 p.m.

Related to password in sodium...