Gaviota EGTBs cp4 MD5 checksum program
Posted: 18 Dec 2010, 18:46
Hello all,
I just finish downloading all the *.cp4 gaviota end game table bases (Thanks Miguel for creating them and Josh Shriver for hosting them, and everybody else involved in one way or another).
As all you know, there is always the possibility of files getting corrupted while downloading them, so a MD5 checksum for all the 145 files is provided at the same site http://www.olympuschess.com/egtb/gaviota/
Doing this manually one file at the time is very tedious, so I created a perl script and an executable (windows only) to do the MD5 checksum for us.
This program assumes that is being launched from the parent directory for the folder where the tablebases are and that the name of that folder is GTB. Example: The program and/or the script is in c:\gaviota , and the tablebases are in c:\gaviota\GTB .
If a mismatch in the checksum is found, the script will stop and prompt the user to continue or abort. Needless to say, if not mismatches are found, the script will just exit.
The code:
Of course this little script has lots of rooms for improvement...feel free to do whatever you want with it.
The links:
For the perl script->http://www.mediafire.com/?dc7hj3slplug8t2
For the windows executable http://www.mediafire.com/?3tl3hq99qjat26s
Best regards,
matematiko
I just finish downloading all the *.cp4 gaviota end game table bases (Thanks Miguel for creating them and Josh Shriver for hosting them, and everybody else involved in one way or another).
As all you know, there is always the possibility of files getting corrupted while downloading them, so a MD5 checksum for all the 145 files is provided at the same site http://www.olympuschess.com/egtb/gaviota/
Doing this manually one file at the time is very tedious, so I created a perl script and an executable (windows only) to do the MD5 checksum for us.
This program assumes that is being launched from the parent directory for the folder where the tablebases are and that the name of that folder is GTB. Example: The program and/or the script is in c:\gaviota , and the tablebases are in c:\gaviota\GTB .
If a mismatch in the checksum is found, the script will stop and prompt the user to continue or abort. Needless to say, if not mismatches are found, the script will just exit.
The code:
- Code: Select all
#!/usr/bin/perl
use strict;
use Digest::MD5;
use Cwd;
my $dir = getcwd;
use Term::ReadKey;
my %checksums=(
'kbbbk.gtb.cp4' => 'a8f890093de502c3e136e73780356f59',
'kbbk.gtb.cp4' => '4fcdcf8aeae40ed340524d3064db8f00',
'kbbkb.gtb.cp4' => '04bffa7e7414ae8d96b3a727ed5fe050',
'kbbkn.gtb.cp4' => '9b82696889d0144ed16975d4ae026fc9',
'kbbkp.gtb.cp4' => 'c69782fdcd8e206d47d4e76479342c93',
'kbbkq.gtb.cp4' => '76bacddb2b06151ee853b7067b8de78f',
'kbbkr.gtb.cp4' => 'd79daa3ab2c49b5f9bab0e9cb4293852',
'kbbnk.gtb.cp4' => '6eb1d11108f2574fe8e6e3ff5436b717',
'kbbpk.gtb.cp4' => 'a94e07a402110066c29cfd4e5bbfe582',
'kbk.gtb.cp4' => 'd7a5b1b3ead671273ed96b41e0616510',
'kbkb.gtb.cp4' => 'ba458a182dab40ebe55b603436b2df6c',
'kbkn.gtb.cp4' => 'ab567cdcd5db194dc359a758b788de59',
'kbkp.gtb.cp4' => '6faa8559ec6d859d11fd1b910670baf2',
'kbnk.gtb.cp4' => 'a8535ea4eaf24da8f39269405176c20d',
'kbnkb.gtb.cp4' => '66142fc0b46b7940fc09df0997735eac',
'kbnkn.gtb.cp4' => 'a4b4d2cc7428fc48fda81f8e55727802',
'kbnkp.gtb.cp4' => '74b529ca7d73186ce6414ec3f026f18a',
'kbnkq.gtb.cp4' => '4a830baf7a59fa61ef14d22a7610f238',
'kbnkr.gtb.cp4' => 'dded1b638084872a87a0dad7ac13c744',
'kbnnk.gtb.cp4' => '140f5d3b5b0bfa8bb81344a8616f1884',
'kbnpk.gtb.cp4' => '62bc5067166360a75b6e8eca2264ebaf',
'kbpk.gtb.cp4' => '15bf2c4eda7ce13f365ffcc415f43755',
'kbpkb.gtb.cp4' => '3a1aae1fcd1cdb6ccad5e85a3c5a258a',
'kbpkn.gtb.cp4' => '28c023da2920a6fae7fb1072d4ba2efc',
'kbpkp.gtb.cp4' => 'acbfd3cbd7e1c599ad66536230471146',
'kbpkq.gtb.cp4' => '77b78d4e0f3733971356ee327c8a11cd',
'kbpkr.gtb.cp4' => '2528ea44f6c998b766360b2419cb3bf5',
'kbppk.gtb.cp4' => '984b96cffc7abaf0652e56385b24bec1',
'knk.gtb.cp4' => '5b56485e4c99f2d91172d4676a0de939',
'knkn.gtb.cp4' => '6dad70682e806c4b8857126fd0c00ef6',
'knkp.gtb.cp4' => '5c6386b80580d428db86ac6660af0407',
'knnk.gtb.cp4' => '0c098f3f87e951148347ab05ba3f83ad',
'knnkb.gtb.cp4' => 'd0ac83502ff3177704b49a14f05aae21',
'knnkn.gtb.cp4' => '0fc7014da6ebb46639d73fa0c7019b25',
'knnkp.gtb.cp4' => '5768291aec98fa3e5101ee8cdb840207',
'knnkq.gtb.cp4' => '8680eeb6319ad7ad5ed64df0a5bede06',
'knnkr.gtb.cp4' => 'af8646512e16feb9fff32a0a974df267',
'knnnk.gtb.cp4' => '18f41848a10dd0a29dd654f52f4bef1e',
'knnpk.gtb.cp4' => '97c84fed8d00a997d64283ab28a71eb9',
'knpk.gtb.cp4' => '181a3ea0ee0c9fff38074fa5c5c116d1',
'knpkb.gtb.cp4' => '39923cb8966170e600e57280f91bb2a2',
'knpkn.gtb.cp4' => '6c7eda069bbc38cc8e52fc88fac46eb6',
'knpkp.gtb.cp4' => '34fbb37b8d058e5b5cef3633009230fb',
'knpkq.gtb.cp4' => '58a30bb06cbb9ed62cc291cf512a1a36',
'knpkr.gtb.cp4' => '2b51af797ecff8089fe88db53ceb2a23',
'knppk.gtb.cp4' => '4a88a971f2a15bb593a7161ef9d45649',
'kpk.gtb.cp4' => 'ecaa0490d03cc256b5183eddee44d035',
'kpkp.gtb.cp4' => 'ce6140faf1be7b9a3f0b4f2bcc865cba',
'kppk.gtb.cp4' => '6394960362d45f3890966908faff8e08',
'kppkb.gtb.cp4' => '9165a27cd193f45c7220d6a6b958b77d',
'kppkn.gtb.cp4' => '999d73c6ae63d1b9af9a502d6d4bdd75',
'kppkp.gtb.cp4' => 'a305cf31262bb8fe0c16c7a08a12e02c',
'kppkq.gtb.cp4' => 'a3b310ca7ad2832d514397d7f555f5b0',
'kppkr.gtb.cp4' => '65af4818e2900e9d71e3826a63b64690',
'kpppk.gtb.cp4' => '482f44afc2f79e9a5fad4b4999f5ebb8',
'kqbbk.gtb.cp4' => '531ba8063886d60060f2109a651b9184',
'kqbk.gtb.cp4' => '4f2ce5825092badb27ac9f043618a757',
'kqbkb.gtb.cp4' => '6da22d75bfd0ea65158c92df4f91fbfd',
'kqbkn.gtb.cp4' => 'c02c88aba3965c599c46fdc8b17083b4',
'kqbkp.gtb.cp4' => 'b1fbf3ef4b29228169b607a80ebb3c40',
'kqbkq.gtb.cp4' => '2d9aa0de54333b7420e57caf304b090b',
'kqbkr.gtb.cp4' => '183cd91d512cd3f3b2c2fb02b87db5d1',
'kqbnk.gtb.cp4' => '92618cb777f11d0852fd929f11b6aefb',
'kqbpk.gtb.cp4' => 'c35ff872e9a96a1a16e9439cd4654309',
'kqk.gtb.cp4' => 'c80c5b3e32f601dfaa7f3f6b6a431ef7',
'kqkb.gtb.cp4' => 'ca66e0dde89d878ae4e169c7d215f394',
'kqkn.gtb.cp4' => 'c2595ff5cbecce1da16a74ab6320a41f',
'kqkp.gtb.cp4' => '3f67e8e868da5e5d041149409ec68dda',
'kqkq.gtb.cp4' => '43d12fb52c7290b50a3291563f91c85b',
'kqkr.gtb.cp4' => 'd0280706e743b4321aa5d17fc2b559e0',
'kqnk.gtb.cp4' => '0f10dda2145623eedfb8448db0d142fd',
'kqnkb.gtb.cp4' => 'bd6afd6c2ffb765bf71ec92df4b54c78',
'kqnkn.gtb.cp4' => 'a3caf7f1eb2a2a1298e7defcd437dea9',
'kqnkp.gtb.cp4' => 'ec32dfa1fc5219e55cb7effa0a5780e5',
'kqnkq.gtb.cp4' => 'ccc3ff0a7f1de7f874e07c99de7eef25',
'kqnkr.gtb.cp4' => 'cc12538e4ff9e6243ab136144a8c9f52',
'kqnnk.gtb.cp4' => '0d7d0ac820bcf5b726ddf25bcd4fdb29',
'kqnpk.gtb.cp4' => '5424c1c560928cdffde9b9a9c04b794a',
'kqpk.gtb.cp4' => '4b3bca9064e50169830cd6df4140cc31',
'kqpkb.gtb.cp4' => '2c63aefb98b74d76e63b136b18359ef5',
'kqpkn.gtb.cp4' => '67e29251acef7501ec9aa3586ac849cb',
'kqpkp.gtb.cp4' => '210823e26ad07483bbd8313cb9d9226f',
'kqpkq.gtb.cp4' => '89a58dbed5a816bf95c43acafbd8d0cf',
'kqpkr.gtb.cp4' => '5e972e913ad9a9fd174c182055db3436',
'kqppk.gtb.cp4' => '72cfe4cf6b15098b9398e7cb86b0c622',
'kqqbk.gtb.cp4' => '0414d5ab06526ae141c0d3f6338e0412',
'kqqk.gtb.cp4' => '40cd9c8dbdc7a214c72f4d92d62ca293',
'kqqkb.gtb.cp4' => 'f236d8782ab4492264026acbd006218c',
'kqqkn.gtb.cp4' => 'b37688f6deaa0a333616ffdd9b886453',
'kqqkp.gtb.cp4' => 'd4bb160dc4aeaeec2e1953bd81b66cac',
'kqqkq.gtb.cp4' => '6df046cef68f3dd1cbcd822cf2dfb626',
'kqqkr.gtb.cp4' => '80e306b557a9cc7af05495a151642a00',
'kqqnk.gtb.cp4' => '785e8e5895856144695cd6ab88e45173',
'kqqpk.gtb.cp4' => '5dfc76bc714ab8e045ce5a6dd840ac00',
'kqqqk.gtb.cp4' => '868a980f137122641a80b1079e2e4e8b',
'kqqrk.gtb.cp4' => '0f117c298bc47dbbb138ca89331fd9cd',
'kqrbk.gtb.cp4' => '97e1b72d3dfc22e1ae629e801b8151d1',
'kqrk.gtb.cp4' => '98a640759dc1a41442a733a408614b3d',
'kqrkb.gtb.cp4' => 'b4dcc3d37b19b8118f8450297f9e7298',
'kqrkn.gtb.cp4' => '3fa3f1d4c6a037d89c70931c9c173d68',
'kqrkp.gtb.cp4' => '4a2b1f72ed228f3b630e31c4bc7b865b',
'kqrkq.gtb.cp4' => '43ba93d167fa2d3fc61b3aa7f661baa2',
'kqrkr.gtb.cp4' => 'b07d79302a632706d8397f0e0ad17358',
'kqrnk.gtb.cp4' => '60ecea32b15a8134aa3d5ae7e7fd9155',
'kqrpk.gtb.cp4' => '78503609013afef7680aeea8ad6fffc3',
'kqrrk.gtb.cp4' => '1caf14ef4e63f1f11d3ad640905b30e3',
'krbbk.gtb.cp4' => '3ada834784208fedf8d063939fc2162a',
'krbk.gtb.cp4' => '94436bdbde50a729bfdc4b0c555b461b',
'krbkb.gtb.cp4' => '8b7af56135ec11b7a487c3a45781e400',
'krbkn.gtb.cp4' => '6dd48d2c3c8f3d2f13a1bc0edf12dbeb',
'krbkp.gtb.cp4' => '9ed81ee94967377d112a416871991e4c',
'krbkq.gtb.cp4' => 'ebd0fd750340258c017c5191f3bf8e87',
'krbkr.gtb.cp4' => '5317cab585889301053879d864222fb5',
'krbnk.gtb.cp4' => 'fc60350011c4c9401cd1009a4c57f9f7',
'krbpk.gtb.cp4' => 'b61a73019d16632a184e204c5e4c853c',
'krk.gtb.cp4' => '959fd626c3ef3183aa4ddeca4ecf63a6',
'krkb.gtb.cp4' => '495fe78e5114fc3f71fde18c200a7cb9',
'krkn.gtb.cp4' => '7205930e8b753b72e8126c9ddb71ef96',
'krkp.gtb.cp4' => 'c7265398554b100b27f3073c9fa40b02',
'krkr.gtb.cp4' => '05cb36f60da56ba5bdf199e3073b391b',
'krnk.gtb.cp4' => '774968a2412336ff2877c7bce065eede',
'krnkb.gtb.cp4' => '902a8495997a68268ab8ff13995ca406',
'krnkn.gtb.cp4' => 'e082f01333a90024fc893d9a8490d46c',
'krnkp.gtb.cp4' => '1005b5b5911975b14920ea74e972fb77',
'krnkq.gtb.cp4' => 'bc045beda2fe9d76b20fab45c4dff056',
'krnkr.gtb.cp4' => '02db6817c92183ac3946fe11df091a05',
'krnnk.gtb.cp4' => '209fd5a5243ae7f0485a1e9fe9ede45b',
'krnpk.gtb.cp4' => 'b061faf8b6a17a098f8afbba343a55ef',
'krpk.gtb.cp4' => 'e16129bc69cdc655c11d0d58c02461c5',
'krpkb.gtb.cp4' => '657436f28c4c739b2d449e94ee388bfe',
'krpkn.gtb.cp4' => '346ff695f92adae7be6d4f8baa76d799',
'krpkp.gtb.cp4' => '5c61d50b5e4ccbfe9cf1355f53365c02',
'krpkq.gtb.cp4' => 'd674b3296276a75260d18d2f4c3eb307',
'krpkr.gtb.cp4' => '59f3e3f392937b02c2530244944a6c25',
'krppk.gtb.cp4' => '59bd05f7ac4359fe8a6b239991904e43',
'krrbk.gtb.cp4' => 'c157625aab03ca7b809d3188063e6aa0',
'krrk.gtb.cp4' => '9e61da42b0b345c66a71db00f15a38b8',
'krrkb.gtb.cp4' => 'ac98073e8646b2c756853e7c74673a1d',
'krrkn.gtb.cp4' => '215cc6e989bc50a209af13a52f481a66',
'krrkp.gtb.cp4' => '9119c5f01ebcf3f1b189f9425fca1715',
'krrkq.gtb.cp4' => '7f78c8b41d4b5abc610a1817ced75753',
'krrkr.gtb.cp4' => 'f7fe3ec24945f940cffc7a8e7a42c0d7',
'krrnk.gtb.cp4' => 'f975b76cf64ca964346b42808cded508',
'krrpk.gtb.cp4' => '88bba6d0554e136ce8590d6c137085e7',
'krrrk.gtb.cp4' => 'edca4203628a99fd66b90411a975447b',
);
my $numberofchecksums=scalar(keys(%checksums));
my $EGDirectory="$dir"."\/GTB";
my @files = <$EGDirectory/*.cp4>;
my $size=@files;
unless ($size==$numberofchecksums) {
print "The number of files($size) does not match the number expected (145).\n";
print "Press any 1 to continue or 2 to abort the program:\n";
ReadMode 'cbreak';
my $char;
until(($char eq '1') or ($char eq '2')) {
$char = ReadKey(0);
}
ReadMode 'normal';
if ($char eq '2') {
exit;
}
}
my @sortedbases;
foreach my $key (sort (keys(%checksums))) {
push (@sortedbases,$key);
}
my $matches=0;
foreach my $ok (@sortedbases) {
my $file= "$dir"."\/GTB\/$ok";
my $hexsum=$checksums{$ok};
print "Checking MD5 checksum for $ok, please wait.....\n\n";
open(FILE, $file) or die "Can't open '$file': $!";
binmode(FILE);
my $md5 = Digest::MD5->new;
while (<FILE>) {
$md5->add($_);
}
close(FILE);
my $digest = $md5->hexdigest;
if ($digest eq $hexsum) {
print "MD5 checksum for $ok is a match.\n";
$matches++;
}
else {
print "Error: MD5 checksum for $ok is a missmatch.\n";
print "Press any 1 to continue or 2 to abort the program:\n";
ReadMode 'cbreak';
my $char;
until(($char eq '1') or ($char eq '2')) {
$char = ReadKey(0);
}
ReadMode 'normal';
if ($char eq '2') {
exit;
}
}
}
print "\nThere were $matches matches.\n";
Of course this little script has lots of rooms for improvement...feel free to do whatever you want with it.
The links:
For the perl script->http://www.mediafire.com/?dc7hj3slplug8t2
For the windows executable http://www.mediafire.com/?3tl3hq99qjat26s
Best regards,
matematiko