From: Marius Gavrilescu Date: Sat, 14 Apr 2018 15:30:55 +0000 (+0300) Subject: Better POD X-Git-Tag: 0.002~2 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=025ae5f357a01188476b3baafe528ed583a5306b;p=authen-passphrase-scrypt.git Better POD --- diff --git a/lib/Authen/Passphrase/Scrypt.pm b/lib/Authen/Passphrase/Scrypt.pm index fabc7ae..3a43e25 100644 --- a/lib/Authen/Passphrase/Scrypt.pm +++ b/lib/Authen/Passphrase/Scrypt.pm @@ -98,9 +98,9 @@ Authen::Passphrase::Scrypt - passphrases using Tarsnap's scrypt algorithm use Authen::Passphrase::Scrypt; # Hash a password - my $sc = Authen::Passphrase::Scrypt->new({ + my $sc = Authen::Passphrase::Scrypt->new( passphrase => 'correcthorsebatterystaple' - }); + ); my $hash = $sc->as_rfc2307; say "The given password hashes to $hash"; @@ -111,13 +111,13 @@ Authen::Passphrase::Scrypt - passphrases using Tarsnap's scrypt algorithm say 'The password was "xkcd"' if $sc->match('xkcd'); # Advanced hashing - my $sc = Authen::Passphrase::Scrypt->new({ + my $sc = Authen::Passphrase::Scrypt->new( passphrase => 'xkcd', logN => 14, # General work factor r => 16, # Memory work factor p => 1, # CPU (parallellism) work factor salt => 'SodiumChloride && sODIUMcHLORIDE', # Must be 32 bytes - }); + ); say 'The given password now hashes to ', $sc->as_rfc2307; =head1 DESCRIPTION @@ -136,10 +136,11 @@ from within L. The methods are: =over -=item Authen::Passphrase::Scrypt->B(I<\%args>) +=item Authen::Passphrase::Scrypt->B(I<%args>) Creates a new L from a given passphrase -and parameters. Use this to hash a passphrase. The arguments are: +and parameters. Use this to hash a passphrase. This function takes +either a key value list or a hashref. The arguments are: =over @@ -176,6 +177,8 @@ fine-tuning: if scrypt uses too much memory but not enough CPU, decrease logN and increase p; if scrypt uses too much CPU but not enough memory, decrease logN and increase r. +Note that C<< 2^logN >> must fit in 64 bits and C<< r * p < 2^30 >>. + =item $sc->B Returns the hash of the passphrase, in RFC2307 format. This is @@ -192,6 +195,7 @@ Returns true if the given passphrase matches the hash, false otherwise. =item Authen::Passphrase::Scrypt->from_crypt + =item $sc->as_crypt These functions both croak. They are provided for compatibility with