diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-05-13 13:31:58 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-05-13 13:31:58 +0200 |
commit | 2dce451112537026d805e748f86bb7fbaa554c93 (patch) | |
tree | a550dafd25d672dc2d9375f0d3a14f1b021fb62d /lib/App/Raps2 | |
parent | 04fe107361cd6b2002c88970e97e0fd4733222e1 (diff) |
sed -r "s/\{'([^']+)'}/\{\1}/g"
Diffstat (limited to 'lib/App/Raps2')
-rw-r--r-- | lib/App/Raps2/Password.pm | 26 |
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}, )); } |