SodiumScrypt
NAME
Crypt::SodiumScrypt - scrypt password hashing using libsodium
SYNOPSIS
use Crypt::SodiumScrypt;
my $password = 'somepa55word';
my $hash = scrypt-hash($password);
if scrypt-verify($hash, $password ) {
# password ok
}
DESCRIPTION
This module provides a binding to the scrypt password hashing functions provided by libsodium.
The Scrypt algorithm is designed to be prohibitively expensive in terms of time and memory for a brute force attack, so is considered relatively secure. However this means that it might not be suitable for use on resource constrained systems.
The hash returned by scrypt-hash
is in the format used in
/etc/shadow
and can be verified by other libraries that understand the
Scrypt algorithm ( such as the libxcrypt
that is used for password
hashing on some Linuc distributions.) By default the interactive
limits for memory and CPU usage are used, which is a reasonable
compromise for the time taken for both hashing and verification. If the
:sensitive
switch is supplied to scrypt-hash
then both hashing
and verification take significantly longer (and use more memory,) so
this may not suitable for some applications.
The scrypt-verify
should be able to verify passwords against Scrypt
hashes produced by other libraries (that is the hash has the prefix $7$, )
but if you don't have control of the hashing parameters it may take longer
than is desirable.