NAME

App::Raps2::Password - Password class for App::Raps2

SYNOPSIS

use App::Raps2::Password;

my $pass = App::Raps2::Password->new(
    passphrase => 'secret',
);

my $oneway_hash = $raps2->bcrypt();
$raps2->verify($oneway_hash);

my $twoway_hash = $raps2->encrypt('data');
print $raps2->decrypt($twoway_hash);
# "data"

VERSION

This manual documents App::Raps2::Password version 0.54

DESCRIPTION

App::Raps2::Pasword is a wrapper around Crypt::Eksblowfish.

METHODS

$pass = App::Raps2::Password->new(%conf)

Creates a new App::Raps2::Password object. You can only have one passphrase per object. Arguments:

cost => int

Cost to pass to Crypt::Eksblowfish, defaults to 12.

passphrase => string

Passphrase to operate with. Mandatory.

salt => string

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

$pass->create_salt()

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

$pass->salt([salt])

Returns the currently used salt and optionally changes it to salt.

$pass->encrypt(data => data, [salt => salt], [cost => cost])

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

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

$pass->decrypt(data => hexstr, [salt => salt], [cost => cost])

Decrypts hexstr (as created by encrypt), returns its original content.

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

$pass->bcrypt()

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

$pass->verify(hash)

Verify a hash as returned by crypt.

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

DIAGNOSTICS

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

DEPENDENCIES

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

BUGS AND LIMITATIONS

Unknown.

SEE ALSO

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

AUTHOR

Copyright (C) 2011-2015 by Daniel Friesel <derf@finalrewind.org>

LICENSE

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