Crypt-Passphrase-Scrypt
view release on metacpan or search on metacpan
lib/Crypt/Passphrase/Scrypt.pm view on Meta::CPAN
return $class->secure_compare($new_hash, $old_hash);
}
return !!0;
}
sub recode_hash {
my ($self, $hash) = @_;
return $hash if $self->{format} eq 'libcrypt';
if (my ($encoded_cost, $encoded_block_size, $encoded_parallel, $salt, $encoded_hash) = $hash =~ $regex7) {
my ($cost, $block_size, $parallel) = map { decode_crypt64_number($_) } $encoded_cost, $encoded_block_size, $encoded_parallel;
my $decoded = decode_crypt64($encoded_hash);
my $recoded_hash = encode_base64($decoded, '');
return sprintf '$scrypt$ln=%d,r=%d,p=%d$%s$%s', $cost, $block_size, $parallel, encode_base64($salt, ''), $recoded_hash;
}
return $hash;
}
1;
#ABSTRACT: A scrypt encoder for Crypt::Passphrase
__END__
( run in 0.654 second using v1.01-cache-2.11-cpan-d7f47b0818f )