NAME
Mojolicious::Plugin::Scrypt - Scrypt salted password hashing for Mojolicious
SYNOPSIS
# Mojolicious
$self->plugin('Scrypt');
# Mojolicious::Lite
plugin 'Scrypt';
Plugin Configurations
$self->plugin( 'Scrypt', {
salt_length => int, # default: 32
cost => int, # default: 16384
block_size => int, # default: 8
parallelism => int, # default: 1
derived_length => int, # default: 32
});
For more infomation see Crypt::ScryptKDF.
DESCRIPTION
Mojolicious::Plugin::Scrypt module use Scrypt algorithm creates a password hash. Other encryption algorithms include Argon2 or PBKDF2, Bcrypt and more.
HELPERS
scrypt
my $encoded = $app->scrypt($password);
Use random salt, default length 32.
# or use your salt
my $salt = 'saltSalt';
my $encoded2 = $app->scrypt($password, $salt);
Do you want to generate salt?
Mojolicious::Plugin::Scrypt using Crypt::PRNG. You can use Crypt::PRNG::random_bytes()
, Crypt::PRNG::random_string()
, ...and more.
scrypt_verify
sub login {
my $c = shift;
my $password = $c->param('password');
my $encoded = get_hash_from_db();
if ( $c->scrypt_verify($password, $encoded) ){
# Correct
...
} else {
# Incorrect
...
}
}
METHODS
register
$plugin->register(Mojolicious->new);
Register plugin in Mojolicious application.
AUTHOR
Munenori Sugimura <clicktx@gmail.com>
SEE ALSO
Crypt::ScryptKDF, Mojolicious, Mojolicious::Guides, http://mojolicious.org.
LICENSE
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.