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

📄 filters.cpp

📁 含有多种公开密钥算法、多种块加密、多种数据流加密、多种HASH函数、多种CheckSum校验、多种MAC校验等几十种加密算法的程序
💻 CPP
字号:
/************************************************** Filters Source File                            ** (C) 1999-2002 The Botan Project                **************************************************/#include <botan/filters.h>#include <botan/lookup.h>namespace Botan {/************************************************** StreamCipher_Filter Constructor                **************************************************/StreamCipher_Filter::StreamCipher_Filter(const std::string& sc_name,                                         const SymmetricKey& key)   {   cipher = get_stream_cipher(sc_name);   cipher->set_key(key);   }/************************************************** Write data into a StreamCipher_Filter          **************************************************/void StreamCipher_Filter::write(const byte input[], u32bit length)   {   while(length)      {      u32bit copied = std::min(length, buffer.size());      cipher->encrypt(input, buffer, copied);      send(buffer, copied);      input += copied;      length -= copied;      }   }/************************************************** Hash_Filter Constructor                        **************************************************/Hash_Filter::Hash_Filter(const std::string& hash_name, u32bit len) :   OUTPUT_LENGTH(len)   {   hash = get_hash(hash_name);   }/************************************************** Complete a calculation by a Hash_Filter        **************************************************/void Hash_Filter::end_msg()   {   SecureVector<byte> output = hash->final();   if(OUTPUT_LENGTH)      send(output, std::min(OUTPUT_LENGTH, output.size()));   else      send(output, output.size());   }/************************************************** MAC_Filter Constructor                         **************************************************/MAC_Filter::MAC_Filter(const std::string& mac_name, const SymmetricKey& key,                       u32bit len) : OUTPUT_LENGTH(len)   {   mac = get_mac(mac_name);   mac->set_key(key);   }/************************************************** Complete a calculation by a MAC_Filter         **************************************************/void MAC_Filter::end_msg()   {   SecureVector<byte> output = mac->final();   if(OUTPUT_LENGTH)      send(output, std::min(OUTPUT_LENGTH, output.size()));   else      send(output, output.size());   }}

⌨️ 快捷键说明

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