Commit | Line | Data |
6bc89f92 |
1 | use Test; |
2 | use strict; |
3 | use integer; |
4 | use Digest::SHA; |
5 | |
41c686de |
6 | BEGIN { |
77d2a621 |
7 | if ($ENV{PERL_CORE}) { |
8 | chdir 't' if -d 't'; |
9 | @INC = '../lib'; |
10 | } |
41c686de |
11 | } |
12 | |
6bc89f92 |
13 | BEGIN { plan tests => 1 } |
14 | |
15 | my $i; |
16 | my $bitstr = pack("B*", "1" x 3999); |
17 | my $state = Digest::SHA->new("sHa1"); |
18 | |
19 | # Note that (1 + 2 + ... + 3999) + 2000 = 8000000 |
20 | |
21 | for ($i = 0; $i <= 3999; $i++) { |
22 | $state->add_bits($bitstr, $i); |
23 | } |
24 | $state->add_bits($bitstr, 2000); |
25 | |
26 | ok( |
27 | $state->hexdigest, |
28 | "559a512393dd212220ee080730d6f11644ba0222" |
29 | ); |