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 $reps = 8000000; |
16 | my $bitstr = pack("B*", "11111111" x 127); |
17 | my $maxbits = 8 * 127; |
18 | my $state = Digest::SHA->new(1); |
19 | my $num; |
20 | |
21 | while ($reps > $maxbits) { |
22 | $num = int(rand($maxbits)); |
23 | $state->add_bits($bitstr, $num); |
24 | $reps -= $num; |
25 | } |
26 | $state->add_bits($bitstr, $reps); |
27 | |
28 | ok( |
29 | $state->hexdigest, |
30 | "559a512393dd212220ee080730d6f11644ba0222" |
31 | ); |