From 2dce451112537026d805e748f86bb7fbaa554c93 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 13 May 2011 13:31:58 +0200 Subject: sed -r "s/\{'([^']+)'}/\{\1}/g" --- lib/App/Raps2/Password.pm | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'lib/App/Raps2/Password.pm') 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}, )); } -- cgit v1.2.3