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

📄 eme_pkcs.cpp

📁 含有多种公开密钥算法、多种块加密、多种数据流加密、多种HASH函数、多种CheckSum校验、多种MAC校验等几十种加密算法的程序
💻 CPP
字号:
/************************************************** PKCS1 EME Source File                          ** (C) 1999-2002 The Botan Project                **************************************************/#include <botan/eme_pkcs.h>#include <botan/rng.h>namespace Botan {/************************************************** PKCS1 Pad Operation                            **************************************************/SecureVector<byte> EME_PKCS1v15::pad(const byte in[], u32bit inlen,                                     u32bit olen) const   {   olen /= 8;   if(olen < 10)      throw Exception("PKCS1: Output space too small");   if(inlen > olen - 10)      throw Exception("PKCS1: Input is too large");   SecureVector<byte> out(olen);   out[0] = 0x02;   for(u32bit j = 1; j != olen - inlen - 1; j++)      while(out[j] == 0)         out[j] = Global_RNG::random();   out.copy(olen - inlen, in, inlen);   return out;   }/************************************************** PKCS1 Unpad Operation                          **************************************************/SecureVector<byte> EME_PKCS1v15::unpad(const byte in[], u32bit inlen,                                       u32bit key_len) const   {   if(inlen != key_len / 8 || inlen < 10 || in[0] != 0x02)      throw Decoding_Error("PKCS1::unpad");   u32bit seperator = 0;   for(u32bit j = 0; j != inlen; j++)      if(in[j] == 0)         {         seperator = j;         break;         }   if(seperator < 9)      throw Decoding_Error("PKCS1::unpad");   return SecureVector<byte>(in + seperator + 1, inlen - seperator - 1);   }/************************************************** Return the max input size for a given key size **************************************************/u32bit EME_PKCS1v15::maximum_input_size(u32bit keybits) const   {   if(keybits / 8 > 10)      return ((keybits / 8) - 10);   else      return 0;   }}

⌨️ 快捷键说明

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