⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hash.cpp

📁 含有多种公开密钥算法、多种块加密、多种数据流加密、多种HASH函数、多种CheckSum校验、多种MAC校验等几十种加密算法的程序
💻 CPP
字号:
/*Prints the message digest of files, using an arbitrary hash functionchosen by the user. This is less flexible that I might like, for example:   ./hash sha1 some_file [or md5 or sha-1 or ripemd160 or ...]will not work, cause the name lookup is case-sensitive. Oh well...Written by Jack Lloyd (lloyd@randombit.net), on August 4, 2002This file is in the public domain*/#include <iostream>#include <fstream>#include <botan/filters.h>#include <botan/lookup.h>int main(int argc, char* argv[])   {   if(argc < 3)      {      std::cout << "Usage: hash digest <filenames>" << std::endl;      return 1;      }   Botan::LibraryInitializer init;   if(!Botan::have_hash(argv[1]))      {      std::cout << "Unknown hash \"" << argv[1] << "\"" << std::endl;      return 1;      }   try {   Botan::Pipe pipe(new Botan::Hash_Filter(argv[1]),                    new Botan::Hex_Encoder);   int skipped = 0;   for(int j = 2; argv[j] != 0; j++)      {      std::ifstream file(argv[j]);      if(!file)         {         std::cout << "ERROR: could not open " << argv[j] << std::endl;         skipped++;         continue;         }      pipe.start_msg();      file >> pipe;      pipe.end_msg();      pipe.set_default_msg(j-2-skipped);      std::cout << pipe << "  " << argv[j] << std::endl;      }   }   catch(std::exception& e)      {      std::cout << "Exception caught: " << e.what() << std::endl;      }   return 0;   }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -