summaryrefslogtreecommitdiff
path: root/lib/App/Raps2/Password.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-05-13 13:31:58 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-05-13 13:31:58 +0200
commit2dce451112537026d805e748f86bb7fbaa554c93 (patch)
treea550dafd25d672dc2d9375f0d3a14f1b021fb62d /lib/App/Raps2/Password.pm
parent04fe107361cd6b2002c88970e97e0fd4733222e1 (diff)
sed -r "s/\{'([^']+)'}/\{\1}/g"
Diffstat (limited to 'lib/App/Raps2/Password.pm')
-rw-r--r--lib/App/Raps2/Password.pm26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/App/Raps2/Password.pm b/lib/App/Raps2/Password.pm
index 6bd6501..189614b 100644
--- a/lib/App/Raps2/Password.pm
+++ b/lib/App/Raps2/Password.pm
@@ -15,13 +15,13 @@ our $VERSION = '0.1';
sub new {
my ($obj, %conf) = @_;
- $conf{'cost'} //= 12;
+ $conf{cost} //= 12;
- if (not (defined $conf{'salt'} and length($conf{'salt'}) == 16)) {
+ if (not (defined $conf{salt} and length($conf{salt}) == 16)) {
confess('incorrect salt length');
}
- if (not (defined $conf{'passphrase'} and length $conf{'passphrase'})) {
+ if (not (defined $conf{passphrase} and length $conf{passphrase})) {
confess('no passphrase given');
}
@@ -37,16 +37,16 @@ sub salt {
confess('incorrect salt length');
}
- $self->{'salt'} = $salt;
+ $self->{salt} = $salt;
}
sub encrypt {
my ($self, $in) = @_;
my $eksblowfish = Crypt::Eksblowfish->new(
- $self->{'cost'},
- $self->{'salt'},
- $self->{'passphrase'},
+ $self->{cost},
+ $self->{salt},
+ $self->{passphrase},
);
my $cbc = Crypt::CBC->new(-cipher => $eksblowfish);
@@ -57,9 +57,9 @@ sub decrypt {
my ($self, $in) = @_;
my $eksblowfish = Crypt::Eksblowfish->new(
- $self->{'cost'},
- $self->{'salt'},
- $self->{'passphrase'},
+ $self->{cost},
+ $self->{salt},
+ $self->{passphrase},
);
my $cbc = Crypt::CBC->new(-cipher => $eksblowfish);
@@ -72,10 +72,10 @@ sub crypt {
return en_base64(
bcrypt_hash({
key_nul => 1,
- cost => $self->{'cost'},
- salt => $self->{'salt'},
+ cost => $self->{cost},
+ salt => $self->{salt},
},
- $self->{'passphrase'},
+ $self->{passphrase},
));
}