00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "crypto_utils.h"
00020 #include "hashVal.h"
00021 #include "filename.h"
00022
00023 int
00024 main(int argc, char *argv[]) {
00025 const char *usagestr = "Usage: check_md5 <file>";
00026 if (argc < 2) {
00027 cerr << usagestr << endl;
00028 return 1;
00029 }
00030
00031 Filename source_file;
00032 source_file = Filename::from_os_specific(argv[1]);
00033
00034 if(!source_file.exists()) {
00035 cerr << usagestr << endl;
00036 cerr << source_file << " not found!\n";
00037 return 2;
00038 }
00039
00040 HashVal hash;
00041 md5_a_file(source_file, hash);
00042
00043
00044 cout << source_file.get_basename() << " ";
00045 hash.output(cout);
00046 cout << endl;
00047
00048 return 0;
00049 }