Skip to content

Instantly share code, notes, and snippets.

@jpf
Created May 21, 2009 05:38
Show Gist options
  • Select an option

  • Save jpf/115304 to your computer and use it in GitHub Desktop.

Select an option

Save jpf/115304 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
# Makes test vectors for prolog.
use Data::Dumper;
use Digest::MD5 qw(md5 md5_hex md5_base64);
my @testcases = qw(
291546831b9f9975c4b9d80b8a83fa75
b959f348cd1ea2cd4c9845656e87e256
ec696acce6fc9a57bccb4bd070bb3ab0
f5d69d66b74a4bc44435e3d522c9f21b
12a33f7b572bd7c10802cf74b09e934c
50102c1f38ecb45b03277af7765f8b29
d39ebc0b3fa7e6ddd11d2eacab3ac1fc
82807a0c9c6318ac2ef1e570233e84a7
1d9121dcc76f02346fabd716201dad8c
1e6fa083b7d09f9b9ebfccedf250c85f
);
foreach $in (@testcases) {
$binary = unpack("B*", pack("H*", $in));
$md5_bin = md5($binary);
$md5 = unpack("B*", $md5_bin);
$binary_in = join ',', split //, $binary;
$binary_out = join ',', split //, $md5;
printf "test(top_driver,[[%s]], [%s]).\n", $binary_in, $binary_out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment