The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Crypt::Passphrase::Scrypt - A scrypt encoder for Crypt::Passphrase

VERSION

version 0.004

DESCRIPTION

This class implements an scrypt encoder for Crypt::Passphrase. If one wants a memory-hard password scheme Argon2 is recommended instead.

METHODS

new(%args)

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

  • cost

    This is the cost factor that is used to hash passwords, it scales exponentially. It currently defaults to 16, but this may change in any future version.

  • block_size

    This defaults to 8, you probably have no need for changing this.

  • parallelism

    The number of threads used for the hash. This defaults to 1, but this number may change in any future version.

  • output_size

    The size of a hashed value. This defaults to 16 bytes, increasing it only makes sense if your passwords actually contain more than 128 bits of entropy.

  • 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 scrypt 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 cost is lower that desired by the encoder.

crypt_types()

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

verify_password($password, $hash)

This will check if a password matches a scrypt 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.