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

📄 es_file.cpp

📁 含有多种公开密钥算法、多种块加密、多种数据流加密、多种HASH函数、多种CheckSum校验、多种MAC校验等几十种加密算法的程序
💻 CPP
字号:
/************************************************** File EntropySource Source File                 ** (C) 1999-2002 The Botan Project                **************************************************/#include <botan/es_file.h>#include <fstream>namespace Botan {/************************************************** File_EntropySource Constructor                 **************************************************/File_EntropySource::File_EntropySource(bool add_defaults,                                       const std::string& source)   {   if(source != "")      add_source(source);   if(add_defaults)      {      add_source("/dev/urandom");      add_source("/dev/random");      }   }/************************************************** Gather Entropy from Randomness Source          **************************************************/u32bit File_EntropySource::slow_poll(byte output[], u32bit length)   {   u32bit read = 0;   for(u32bit j = 0; j != sources.size(); j++)      {      std::ifstream random_source(sources[j].c_str());      if(!random_source) continue;      random_source.read((char*)output + read, length);      read += random_source.gcount();      length -= random_source.gcount();      if(length == 0)         break;      }   return read;   }/************************************************** Add another source                             **************************************************/void File_EntropySource::add_source(const std::string& source)   {   sources.push_back(source);   }}

⌨️ 快捷键说明

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