| 1 |
stefan |
1.1 |
# Before `make install' is performed this script should be runnable with |
| 2 |
|
|
# `make test'. After `make install' it should work as `perl test.pl' |
| 3 |
|
|
|
| 4 |
|
|
######################### |
| 5 |
|
|
|
| 6 |
|
|
# change 'tests => 10' to 'tests => last_test_to_print'; |
| 7 |
|
|
|
| 8 |
|
|
use Test; |
| 9 |
|
|
BEGIN { plan tests => 13 }; |
| 10 |
|
|
use OpenSSL::Digest qw(digest_hex sha1_hex new_digest); |
| 11 |
|
|
ok(1); |
| 12 |
|
|
|
| 13 |
|
|
ok((OpenSSL::Digest::sha1_hex("hallo\n") eq '56ac1c08fa5479fd57c4a5c65861c4ed3ed93ff8') ? 1 :0); |
| 14 |
|
|
ok((sha1_hex("hallo\n") eq '56ac1c08fa5479fd57c4a5c65861c4ed3ed93ff8') ? 1 :0); |
| 15 |
|
|
ok((OpenSSL::Digest::md5_hex("hallo\n") eq 'aee97cb3ad288ef0add6c6b5b5fae48a') ? 1 :0); |
| 16 |
|
|
ok((OpenSSL::Digest::md2_hex("hallo\n") eq '0b5a59754c4ba601ff1234aba049fd0b') ? 1 :0); |
| 17 |
|
|
ok((OpenSSL::Digest::md4_hex("hallo\n") eq 'bf3d4821a7c02a3bfa9a423c057fc761') ? 1 :0); |
| 18 |
|
|
ok((OpenSSL::Digest::sha_hex("hallo\n") eq '76b9078ec3698799870bfee2ac7f803dd0dc8ad2') ? 1 :0); |
| 19 |
|
|
ok((OpenSSL::Digest::mdc2_hex("hallo\n") eq '17893a33039f9273b0d15d9c97c2073c') ? 1 :0); |
| 20 |
|
|
ok((OpenSSL::Digest::ripemd160_hex("hallo\n") eq '84950d43051dee712a1de55f13e2cf250ad9ace4') ? 1 :0); |
| 21 |
|
|
ok((digest_hex('sha1', 'ha', "llo\n") eq '56ac1c08fa5479fd57c4a5c65861c4ed3ed93ff8') ? 1 :0); |
| 22 |
|
|
ok((digest_hex('sha1', '') eq 'da39a3ee5e6b4b0d3255bfef95601890afd80709') ? 1 :0); |
| 23 |
|
|
ok((digest_hex('sha1') eq 'da39a3ee5e6b4b0d3255bfef95601890afd80709') ? 1 :0); |
| 24 |
|
|
|
| 25 |
|
|
$ctx = new_digest('sha1'); |
| 26 |
|
|
$ctx->update('h'); |
| 27 |
|
|
$ctx->update("allo\n"); |
| 28 |
|
|
ok(($ctx->final_hex eq '56ac1c08fa5479fd57c4a5c65861c4ed3ed93ff8') ? 1 :0); |