Can anyone tell me what the following script does exactly?
Code:
use strict;
sub new{
my($class,@args) = @_;
my $self = [];
bless $self,$class;
return $self;
}
sub decode_pw {
my ($self,$decoded) = @_;
my ($offset, $work);
$decoded = "";
$work =~ s|\&\;|\&|g;
for ($offset=length($_[1]); $offset>0; $offset--) {
$work = ord(substr($_[1], $offset-1, 1)) + 13;
$work = $work - 256 if ($work > 256);
$decoded = $decoded . chr($work);
}
return($decoded);
}
sub encode_pw{
my ($self,$string) = @_;
my($loop,$coded,$work);
for ($loop=length($string); $loop>0; $loop--) {
$work = ord(substr($string, $loop-1, 1));
$work = $work + 256 if ($work < 13);
$work = $work - 13;
$coded = $coded . chr($work);
}
$coded =~ s|\&|\&\;|g;
return $coded;
}