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

📄 pipe_fd.cpp

📁 含有多种公开密钥算法、多种块加密、多种数据流加密、多种HASH函数、多种CheckSum校验、多种MAC校验等几十种加密算法的程序
💻 CPP
字号:
/************************************************** Pipe I/O for Unix Source File                  ** (C) 1999-2002 The Botan Project                **************************************************/#include <botan/pipe.h>#include <unistd.h>namespace Botan {/************************************************** Write data from a pipe into a Unix fd          **************************************************/int operator<<(int fd, Pipe& pipe)   {   static const u32bit BUFFERSIZE = DEFAULT_BUFFERSIZE;   SecureBuffer<byte, BUFFERSIZE> buffer;   while(pipe.remaining())      {      u32bit got = pipe.read(buffer, BUFFERSIZE);      u32bit position = 0;      while(got)         {         ssize_t ret = write(fd, buffer + position, got);         if(ret == -1)            throw Stream_IO_Error("Pipe output operator (unixfd) has failed");         position += ret;         got -= ret;         }      }   return fd;   }/************************************************** Read data from a Unix fd into a pipe           **************************************************/int operator>>(int fd, Pipe& pipe)   {   static const u32bit BUFFERSIZE = DEFAULT_BUFFERSIZE;   SecureBuffer<byte, BUFFERSIZE> buffer;   while(true)      {      ssize_t ret = read(fd, buffer, BUFFERSIZE);      if(ret == 0) break;      if(ret == -1)         throw Stream_IO_Error("Pipe input operator (unixfd) has failed");      pipe.write(buffer, ret);      }   return fd;   }}

⌨️ 快捷键说明

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