blob: cf4be92e3274ccf81d3e247debc6419e55a3fdde (
plain)
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
27
28
29
30
31
|
use Test;
use strict;
use integer;
use Digest::SHA;
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@INC = '../lib';
}
}
BEGIN { plan tests => 1 }
my $reps = 8000000;
my $bitstr = pack("B*", "11111111" x 127);
my $maxbits = 8 * 127;
my $state = Digest::SHA->new(1);
my $num;
while ($reps > $maxbits) {
$num = int(rand($maxbits));
$state->add_bits($bitstr, $num);
$reps -= $num;
}
$state->add_bits($bitstr, $reps);
ok(
$state->hexdigest,
"559a512393dd212220ee080730d6f11644ba0222"
);
|