NAME

Crypt::Passphrase::Linux - An linux crypt encoder for Crypt::Passphrase

VERSION

version 0.003

SYNOPSIS

 my $passphrase = Crypt::Passphrase->new(encoder => {
   module => 'Linux',
   type   => 'sha512',
   rounds => 656_000,
 });

DESCRIPTION

This class implements a Crypt::Passphrase encoder compatible with Linux' crypt.

METHODS

new(%args)

This creates a new crypt 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 choses the crypt type. It supports the following crypt types: sha512 (default), sha256, md5, and apache_md5

  • rounds

    The number of rounds using by the crypt implementation. This defaults to 656000, but may change at any time in the future.

hash_password($password)

This hashes the passwords with argon2 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 are different than desired by the encoder.

crypt_types()

This class supports the following crypt types: 1, 5, 6, apr1.

verify_password($password, $hash)

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