Crypt::Passphrase::Bcrypt - A bcrypt encoder for Crypt::Passphrase
version 0.007
my $passphrase = Crypt::Passphrase->new( encoder => { module => 'Bcrypt', cost => 14, hash => 'sha256', }, );
This class implements a bcrypt encoder for Crypt::Passphrase. For high-end parameters Crypt::Passphrase::Argon2 is recommended over this module as an encoder, as that provides memory-hardness and more easily allows for long passwords.
cost
This is the cost factor that is used to hash passwords. It currently defaults to 14, but this may change in the future.
14
subtype
2b
This is the subtype everyone has been using since 2014.
2y
This type is considered equivalent to 2b. It is common on php but not elsewhere.
2a
This is an old and subtly buggy version of bcrypt. This is mainly useful for Crypt::Eksblowfish compatibility.
2x
This is a very broken version that is only useful for compatibility with ancient php versions.
This is 2b by default, and you're unlikely to want to change this.
hash
Pre-hash the password using the specified hash. It will support any hash supported by Crypt::Bcrypt, which is currently 'sha256', 'sha384' and 'sha512'. This is mainly useful because plain bcrypt is not null-byte safe and only supports 72 characters of input. This uses a salt-keyed hash to prevent password shucking.
'sha256'
'sha384'
'sha512'
This hashes the passwords with bcrypt according to the specified settings and a random salt (and will thus return a different result each time).
This returns true if the hash uses a different cipher or subtype, if any of the cost is lower that desired by the encoder or if the prehashing doesn't match.
This returns the above described subtypes, as well as bcrypt-sha256 for prehashed bcrypt.
bcrypt-sha256
This will check if a password matches a bcrypt hash.
Leon Timmermans <leont@cpan.org>
This software is copyright (c) 2021 by Leon Timmermans.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Crypt::Passphrase::Bcrypt, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Crypt::Passphrase::Bcrypt
CPAN shell
perl -MCPAN -e shell install Crypt::Passphrase::Bcrypt
For more information on module installation, please visit the detailed CPAN module installation guide.