summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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>)