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

📄 hash_id.cpp

📁 含有多种公开密钥算法、多种块加密、多种数据流加密、多种HASH函数、多种CheckSum校验、多种MAC校验等几十种加密算法的程序
💻 CPP
字号:
/************************************************** Hash Function Identification Source File       ** (C) 1999-2002 The Botan Project                **************************************************/#include <botan/hash_id.h>#include <botan/lookup.h>namespace Botan {namespace PKCS_IDS {const byte MD2_ID[] = {0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 0x48,0x86, 0xF7, 0x0D, 0x02, 0x02, 0x05, 0x00, 0x04, 0x10 };const byte MD5_ID[] = {0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 0x48,0x86, 0xF7, 0x0D, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10 };const byte SHA1_ID[] = {0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03,0x02, 0x1A, 0x05, 0x00, 0x04, 0x14 };const byte SHA2_256_ID[] = {0x30, 0x31, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01,0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20 };const byte SHA2_384_ID[] = {0x30, 0x41, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01,0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00, 0x04, 0x30 };const byte SHA2_512_ID[] = {0x30, 0x31, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01,0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40 };}/************************************************** Return the HashID, as specified by PKCS        **************************************************/SecureVector<byte> pkcs_hash_id(const std::string& name_or_alias)   {   std::string name = deref_alias(name_or_alias);   SecureVector<byte> out;   if(name == "MD2")      out.set(PKCS_IDS::MD2_ID, sizeof(PKCS_IDS::MD2_ID));   else if(name == "MD5")      out.set(PKCS_IDS::MD5_ID, sizeof(PKCS_IDS::MD5_ID));   else if(name == "SHA-1")      out.set(PKCS_IDS::SHA1_ID, sizeof(PKCS_IDS::SHA1_ID));   else if(name == "SHA2-256")      out.set(PKCS_IDS::SHA2_256_ID, sizeof(PKCS_IDS::SHA2_256_ID));   else if(name == "SHA2-384")      out.set(PKCS_IDS::SHA2_384_ID, sizeof(PKCS_IDS::SHA2_384_ID));   else if(name == "SHA2-512")      out.set(PKCS_IDS::SHA2_512_ID, sizeof(PKCS_IDS::SHA2_512_ID));   return out;   }/************************************************** Return the HashID, as specified by IEEE 1363   **************************************************/byte ieee1363_hash_id(const std::string& name_or_alias)   {   std::string name = deref_alias(name_or_alias);   byte hash_id = 0;   if(name == "RIPEMD-160")      hash_id = 0x31;   else if(name == "RIPEMD-128")      hash_id = 0x32;   else if(name == "SHA-1")      hash_id = 0x33;   return hash_id;   }}

⌨️ 快捷键说明

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