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::System - An system crypt() encoder for Crypt::Passphrase

VERSION

version 0.014

SYNOPSIS

 my $passphrase = Crypt::Passphrase->new(encoder => 'System');

DESCRIPTION

This class implements a Crypt::Passphrase encoder around your system's crypt() function.

Note that the supported algorithms depend entirely on your platform. The only option portable among unices (descrypt) is not considered safe at all. It will try to pick a good default among the supported options. Because the different algorithms take different parameters they will have to be passed as a settings string if anything else is desired.

By default it uses the first supported algorithm in this list: yescript, scrypt, bcrypt, SHAcrypt, MD5crypt and descrypt.

METHODS

new(%args)

This creates a new crypt encoder, it takes named parameters that are all optional.

  • type

    The type of hash, this must be one of the values returned by the crypt_subtypes method. If none is given it is picked as described above.

  • settings

    The settings used for hashing the password, e.g. '$1$', '$2b$12$', '$6$rounds=65600$', '$7$DU..../....' or '$y$j9T$'. If you don't know what these mean you probably shouldn't touch this parameter. It defaults to something appropriate for your chosen / default algorithm.

  • salt_size

    This sets the salt size for algorithm, it defaults to something that should be sensible for your algorithm.

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_subtypes()

This returns whatever crypt types it can discover on your system.

verify_password($password, $hash)

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