Crypt-Bcrypt

 view release on metacpan or  search on metacpan

t/basic.t  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use strict;
 
 
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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use strict;
 
 
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.249 second using v1.01-cache-2.11-cpan-fd5d4e115d8 )