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->crypt();
$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.3

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)

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

$pass->decrypt(hexstr)

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

$pass->crypt()

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.

DEPENDENCIES

Crypt::CBC, Crypt::Eksblowfish.

SEE ALSO

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

AUTHOR

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

LICENSE

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