App-Raps2

 view release on metacpan or  search on metacpan

lib/App/Raps2/Password.pm  view on Meta::CPAN


Cost to pass to B<Crypt::Eksblowfish>, defaults to 12.

=item B<passphrase> => I<string>

Passphrase to operate with. Mandatory.

=item B<salt> => I<string>

16-byte string to use as salt. If none is specified, B<App::Raps2::Password>
generates its own.

=back

=item $pass->create_salt()

Returns a new 16-byte salt. Contains only printable characters.

=item $pass->salt([I<salt>])

Returns the currently used salt and optionally changes it to I<salt>.

=item $pass->encrypt(B<data> => I<data>, [B<salt> => I<salt>],
[B<cost> => I<cost>])

Encrypts I<data> with the passphrase saved in the object, returns the
corresponding hexadecimal hash (as string).

By default, the salt set in B<salt> or B<new> will be used. You can override
it by specifying I<salt>.

=item $pass->decrypt(B<data> => I<hexstr>, [B<salt> => I<salt>],
[B<cost> => I<cost>])

Decrypts I<hexstr> (as created by B<encrypt>), returns its original content.

By default, the salt set in B<salt> or B<new> will be used. You can override
it by specifying I<salt>.

=item $pass->bcrypt()

Return a base64 bcrypt hash of the password, salted with the salt.

=item $pass->verify(I<hash>)

Verify a hash as returned by B<crypt>.

Returns true if it matches, dies if it doesn't.

=back

=head1 DIAGNOSTICS

When anything goes wrong, App::Raps2::Password will use Carp(3pm)'s B<confess>
method to die with a backtrace.

=head1 DEPENDENCIES

Crypt::CBC(3pm), Crypt::Eksblowfish(3pm).

=head1 BUGS AND LIMITATIONS

Unknown.

=head1 SEE ALSO

Crypt::CBC(3pm), Crypt::Eksblowfish(3pm).

=head1 AUTHOR

Copyright (C) 2011-2015 by Daniel Friesel E<lt>derf@finalrewind.orgE<gt>

=head1 LICENSE

  0. You just DO WHAT THE FUCK YOU WANT TO.



( run in 0.841 second using v1.01-cache-2.11-cpan-39bf76dae61 )