3 use File::Basename qw(dirname);
14 # David Ireland's test vector - SHA-256 digest of "a" x 536870912
16 # Adapted from Julius Duque's original script (t/24-ireland.tmp)
17 # - modified to use state cache via dump()/load() methods
19 BEGIN { plan tests => 1 }
21 my $file = File::Spec->catfile(dirname($0), "ireland.tmp");
22 open(my $fh, q{>}, $file); while (<DATA>) { print $fh $_ } close($fh);
24 my $data = "a" x 1000000;
25 my $vec = "b9045a713caed5dff3d3b783e98d1ce5778d8bc331ee4119d707072312af06a7";
28 unless ($ctx = Digest::SHA->load($file)) {
29 $ctx = Digest::SHA->new(256);
30 for (1 .. 536) { $ctx->add($data) }
31 $ctx->add(substr($data, 0, 870910));
35 ok($ctx->hexdigest, $vec);
41 H:dd75eb45:02d4f043:06b41193:6fda751d:73064db9:787d54e1:52dc3fe0:48687dfa
42 block:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:61:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00