NAME

Crypt::Passphrase::PBKDF2 - A PBKDF2 encoder for Crypt::Passphrase

VERSION

version 0.002

DESCRIPTION

This class implements a PBKDF2 encoder for Crypt::Passphrase. It allows for any SHA-1 or SHA-2 hash, and any number of iterations.

METHODS

new(%args)

This creates a new PBKDF2 encoder, it takes named parameters that are all optional. Note that some defaults are likely to change at some point in the future, as computers get progressively more powerful and cryptoanalysis gets more advanced.

  • type

    This can be any of sha1, sha224, sha256 (default), sha384 or sha512.

  • iterations

    This will be the iteration count, defaulting to 100000.

  • salt_size

    The size of the salt. This defaults to 16 bytes, which should be more than enough for any use-case.

hash_password($password)

This hashes the passwords with pbkdf2 according to the specified settings and a random salt (and will thus return a different result each time).

needs_rehash($hash)

This returns true if the hash uses a different cipher, or if any of the parameters is lower that desired by the encoder.

crypt_types()

This class supports the following crypt types: pbkdf2-sha1, pbkdf2-sha224, pbkdf2-sha225, pbkdf2-sha384 and pbkdf2-512.

verify_password($password, $hash)

This will check if a password matches a pbkdf2 hash.

AUTHOR

Leon Timmermans <leont@cpan.org>

COPYRIGHT AND LICENSE

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.