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

NAME

Authen::Passphrase::Argon2 - Store and check password using Argon2

VERSION

Version 0.01

SYNOPSIS

        use Authen::Passphrase::Argon2;

        $ppr = Authen::Passphrase::Argon2->new(
                salt_random => 1,
                hash_hex => '246172676f6e326924763d3139246d3d33323736382c743d332c703d312459574a6a5a47566d5a7a45794d7724435348383332634a6330347376516f7656492f754441', 
        );

        $algorithm = $ppr->algorithm;
        $salt = $ppr->salt;
        $salt_hex = $ppr->salt_hex;
        $hash = $ppr->hash;
        $hash_hex = $ppr->hash_hex;

        if($ppr->match($passphrase)) { 
                ...
        }

        $userPassword = $ppr->as_crypt;

        .....

        __PACKAGE__->add_columns(
        
        );

NOTE

This is an attempt to make Crypt::Argon2 compliant with Authen::Passphrase. The term **hash** is loosely used in this documentation and implementation. Really when we say hash/hex we are dealing with an Argon2 cryptographic key. consistency.

Methods

Authen::Passphrase::Argon2->new

params

        # Only one of these must be defined for the salt value. An error will be thrown if none or more than one is defined.
        salt - plain text salt value 
        salt_hex - salt in hex value that gets decoded.
        salt_base64 - salt value encoded in base64 that gets decoded.
        salt_random - a random salt will be generated using Data::GUID.

        # Only one of these must be defined for the crypt value. An error will be thrown if none or more than one is defined.
        passphrase - plain text passpord that will be converted to argon2
        hash - plain text argon2 value
        hash_base64 - base64 encoded argon2 value
        hash_hex - hex decimal argon2 value

        # optional params
        cost - optional - default 3 - This is the time-cost factor, typically a small integer that can be derived as explained above.
        factor - optional - default '32M' - This is the memory costs factor. This must be given as a integer followed by an order of magnitude (k, M or G for kilobytes, megabytes or gigabytes respectively), e.g. '64M'.
        parallelism - optional - default 1 - This is the number of threads that are used in computing it. 
        size - optional - default 16 - This is the size of the raw result in bytes. Typical values are 16 or 32.

$ppr->algorithm

Returns the algorithm, in the same form as supplied to the constructor. Which will always be Argon2

$ppr->salt

Returns the salt, in raw form.

$ppr->salt_hex

Returns the salt, as a string of hexadecimal digits.

$ppr->salt_base64

Returns the salt, as a string encoded in base64.

$ppr->as_crypt

Returns the raw argon2 formatted string.

$ppr->as_hex

Returns the raw argon2 formatted string in hex format.

$ppr->as_base64

Returns the raw argon2 formatted string encdoed in base64.

$ppr->as_base64

Returns the raw argon2 formatted string encdoed in base64.

$ppr->hash

Returns the hash value, in raw form.

(lets keep consistency but it's just an alias for as_crypt, perhaps I have some misunderstanding /o\)

$ppr->hash_hex

Returns the hash value, as a string of hexadecimal digits.

$ppr->hash_base64

Returns the hash value, as a string in base64.

$ppr->match($passphrase)

Check whether passphrases match.

AUTHOR

LNATION, <thisusedtobeanemail at gmail.com>

BUGS

Please report any bugs or feature requests to bug-authen-passphrase-argon2 at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Authen-Passphrase-Argon2. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Authen::Passphrase::Argon2

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2018 lnation.

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

http://www.perlfoundation.org/artistic_license_2_0

Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.

If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.

This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.

This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.

Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.