Crypt-Bcrypt

 view release on metacpan or  search on metacpan

t/basic.t  view on Meta::CPAN

use warnings;
use strict;

use Test::More;

use Crypt::Bcrypt qw/bcrypt bcrypt_check bcrypt_prehashed bcrypt_check_prehashed bcrypt_needs_rehash/;
use MIME::Base64 'decode_base64';

sub de_base64($) {
	my($text) = @_;
	$text =~ tr#./A-Za-z0-9#A-Za-z0-9+/#;
	return decode_base64($text);
}

my $password = "Hello World,";
my $salt = "A" x 16;

my $hash1 = bcrypt($password, "2b", 12, $salt);

t/compat.t  view on Meta::CPAN

use warnings;
use strict;

use Test::More;

use Crypt::Bcrypt qw/bcrypt bcrypt_check/;

use MIME::Base64 'decode_base64';

sub de_base64($) {
	my($text) = @_;
	$text =~ tr#./A-Za-z0-9#A-Za-z0-9+/#;
	return decode_base64($text);
}

my @wrong_passwords = qw(foo quux supercalifragilisticexpialidocious);
while(<DATA>) {
	chomp;
	my ($settings, $hash, $password) = split ' ', $_;
	my ($type, $cost, $encoded_salt) = $settings =~ / ^ \$ (2\w?) \$ (\d+) \$ (.*) $ /x or die $settings;



( run in 0.300 second using v1.01-cache-2.11-cpan-fd5d4e115d8 )