summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-05-18 19:44:24 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-05-18 19:44:24 +0200
commit7c28217c765d9bf370cfb691bbe12f4ee39b573e (patch)
treec2deb1965b02ad3739e3c0afec269d1c88272bb0 /lib
parent8f5e8b3bbaf23600d2450f8a694190134773f9e3 (diff)
App/Raps2/Password: salt: Always return
Diffstat (limited to 'lib')
-rw-r--r--lib/App/Raps2/Password.pm14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/App/Raps2/Password.pm b/lib/App/Raps2/Password.pm
index 73eee32..ef24a65 100644
--- a/lib/App/Raps2/Password.pm
+++ b/lib/App/Raps2/Password.pm
@@ -103,22 +103,22 @@ sub create_salt {
=item $pass->salt([I<salt>])
-Gets/Sets the currently used salt.
+Returns the currently used salt and optionally changes it to I<salt>.
=cut
sub salt {
my ($self, $salt) = @_;
- if (not defined $salt) {
- return $self->{salt};
- }
+ if (defined $salt) {
+ if (length($salt) != 16) {
+ confess('incorrect salt length');
+ }
- if (length($salt) != 16) {
- confess('incorrect salt length');
+ $self->{salt} = $salt;
}
- $self->{salt} = $salt;
+ return $self->{salt};
}
=item $pass->encrypt(I<data>)