Commit | Line | Data |
3357b1b1 |
1 | print "1..3\n"; |
2 | |
3 | BEGIN { |
4 | chdir 't' if -d 't'; |
5 | @INC = '../lib'; |
6 | } |
7 | |
8 | use Digest; |
9 | |
d2f5bb60 |
10 | my $hexdigest = "900150983cd24fb0d6963f7d28e17f72"; |
11 | if (ord('A') == 193) { # EBCDIC |
12 | $hexdigest = "fe4ea0d98f9cd8d1d27f102a93cb0bb0"; # IBM-1047 |
13 | } |
14 | |
15 | print "not " unless Digest->MD5->add("abc")->hexdigest eq $hexdigest; |
3357b1b1 |
16 | print "ok 1\n"; |
17 | |
d2f5bb60 |
18 | print "not " unless Digest->MD5->add("abc")->hexdigest eq $hexdigest; |
3357b1b1 |
19 | print "ok 2\n"; |
20 | |
21 | eval { |
22 | print "not " unless Digest->new("HMAC-MD5" => "Jefe")->add("what do ya want for nothing?")->hexdigest eq "750c783e6ab0b503eaa86e310a5db738"; |
23 | print "ok 3\n"; |
24 | }; |
25 | print "ok 3\n" if $@ && $@ =~ /^Can't locate/; |
26 | |