The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Crypt::Passphrase::Yescrypt - A yescrypt encoder for Crypt::Passphrase

VERSION

version 0.001

DESCRIPTION

This class implements an yescrypt encoder for Crypt::Passphrase. yescrypt was one of the finalists of 2015's Password Hash Competition and as such is considered a safe algorithm for passwords.

METHODS

new(%args)

This creates a new yescrypt 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.

  • block_size

    The number of 128 byte units in a block. Reasonable values are from 8 to 96. It default to 32 (4kiB).

  • block_count

    The log₂ of the number of blocks that will be used. It defaults to 12 for 4096 blocks and may change in the future.

  • parallelism

    The number of threads used for the hash. This defaults to 1, and you're unlikely to want to change this.

  • time

    This is the time parameter that the algorithm to use up more time. This default to 0 and should only be used when using more memory isn't an option.

  • flags

    This flags that determine the flavor of yescrypt. It defaults to 0xb6 and unless you know what you're doing you shouldn't be touching this.

  • salt_size

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

Note: there is no wrong or right configuration, it all depends on your own particular circumstances.

hash_password($password)

This hashes the passwords with yescrypt 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 subtype, or if any of the parameters are different from that desired by the encoder.

crypt_types()

This class supports the following crypt types: y and 7.

verify_password($password, $hash)

This will check if a password matches a yescrypt hash.

AUTHOR

Leon Timmermans <leont@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2023 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.