File: 05-crypt-ldap.t

package info (click to toggle)
libcrypt-pbkdf2-perl 0.160410-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 156 kB
  • ctags: 45
  • sloc: perl: 589; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 537 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!perl
use strict;
use warnings;

use Test::More;

BEGIN {
  plan tests => 1 + 1;
  use_ok 'Crypt::PBKDF2';
}

my $encoder = Crypt::PBKDF2->new(
  hash_class => 'HMACSHA2',
  hash_args  => { sha_size => 512 },
  iterations => 100,
  salt_len   => 32,
  encoding   => 'crypt',
);

my $password = "testpass";

my $hash = $encoder->generate($password);

my $decoder = Crypt::PBKDF2->new; # Defaults to LDAP encoding, different hash, etc.

ok $decoder->validate($hash, $password), "Old crypt hash validates with new PBKDF2 that wants LDAP";