An R interface to the OpenBSD 'blowfish' password hashing algorithm, as described in "A Future-Adaptable Password Scheme" by Niels Provos. The implementation is derived from the 'py-bcrypt' module for Python which is a wrapper for the OpenBSD implementation.
This package is mostly to work with existing bcrypt
hashes. For new applications consider using scrypt as implemented in sodium::password_store
or the script
package.
# Secret message as a string
passwd <- "supersecret"
# Create the hash
hash <- hashpw(passwd)
hash
# To validate the hash
identical(hash, hashpw(passwd, hash))
# Or use the wrapper
checkpw(passwd, hash)
# Use varying complexity:
hash11 <- hashpw(passwd, gensalt(11))
hash12 <- hashpw(passwd, gensalt(12))
hash13 <- hashpw(passwd, gensalt(13))
# Takes longer to verify (or crack)
system.time(checkpw(passwd, hash11))
system.time(checkpw(passwd, hash12))
system.time(checkpw(passwd, hash13))
The libbcrypt
source code is currently bundled with the package:
install.packages("bcrypt")