📄 algolist.cpp
字号:
/************************************************** Algorithms List Source File ** (C) 1999-2002 The Botan Project **************************************************/#include <botan/look_add.h>#include <botan/lookup.h>#include <botan/blowfish.h>#include <botan/cast128.h>#include <botan/cast256.h>#include <botan/cscipher.h>#include <botan/des.h>#include <botan/desx.h>#include <botan/gost.h>#include <botan/idea.h>#include <botan/lion.h>#include <botan/lubyrack.h>#include <botan/misty1.h>#include <botan/rc2.h>#include <botan/rc5.h>#include <botan/rc6.h>#include <botan/rijndael.h>#include <botan/safer_sk.h>#include <botan/serpent.h>#include <botan/shark.h>#include <botan/skipjack.h>#include <botan/square.h>#include <botan/tea.h>#include <botan/threeway.h>#include <botan/twofish.h>#include <botan/xtea.h>#include <botan/arc4.h>#include <botan/isaac.h>#include <botan/seal.h>#include <botan/adler32.h>#include <botan/crc24.h>#include <botan/crc32.h>#include <botan/haval.h>#include <botan/md2.h>#include <botan/md4.h>#include <botan/md5.h>#include <botan/rmd128.h>#include <botan/rmd160.h>#include <botan/sha1.h>#include <botan/sha256.h>#include <botan/sha384.h>#include <botan/sha512.h>#include <botan/tiger.h>#include <botan/whrlpool.h>#include <botan/par_hash.h>#include <botan/emac.h>#include <botan/hmac.h>#include <botan/md5mac.h>#include <botan/x919_mac.h>#include <botan/mode_pad.h>namespace Botan {/************************************************** Load the algorithms list **************************************************/void load_algorithms_list() { extern void setup_aliases(); add_algorithm(new Blowfish); add_algorithm(new CAST_128); add_algorithm(new CAST_256); add_algorithm(new CS_Cipher); add_algorithm(new DES); add_algorithm(new DESX); add_algorithm(new TripleDES); add_algorithm(new GOST); add_algorithm(new IDEA); add_algorithm(new MISTY1); add_algorithm(new RC2); add_algorithm(new RC6); add_algorithm(new Rijndael); add_algorithm(new Serpent); add_algorithm(new SHARK); add_algorithm(new Skipjack); add_algorithm(new Square); add_algorithm(new TEA); add_algorithm(new ThreeWay); add_algorithm(new Twofish); add_algorithm(new XTEA); add_algorithm(new ARC4); add_algorithm(new MARK4); add_algorithm(new ISAAC); add_algorithm(new ANSI_X919_MAC); add_algorithm(new MD5MAC); add_algorithm(new Adler32); add_algorithm(new CRC24); add_algorithm(new CRC32); add_algorithm(new MD2); add_algorithm(new MD4); add_algorithm(new MD5); add_algorithm(new RIPEMD_128); add_algorithm(new RIPEMD_160); add_algorithm(new SHA1); add_algorithm(new SHA2_256); add_algorithm(new SHA2_384); add_algorithm(new SHA2_512); add_algorithm(new Tiger); add_algorithm(new Whirlpool); add_algorithm(new PKCS7_Padding); add_algorithm(new OneAndZeros_Padding); add_algorithm(new Null_Padding); setup_aliases(); }/************************************************** Try to get a currently unloaded block cipher **************************************************/BlockCipher* try_to_get_bc(const std::string& algo_name) { std::vector<std::string> name = parse_algorithm_name(algo_name); if(name.size() == 0) return 0; const std::string bc_name = deref_alias(name[0]); if(bc_name == "Lion") { if(name.size() != 4) throw Invalid_Algorithm_Name(algo_name); return new Lion(name[1], name[2], to_u32bit(name[3])); } if(bc_name == "Luby-Rackoff") { if(name.size() != 2) throw Invalid_Algorithm_Name(algo_name); return new LubyRackoff(name[1]); } if(bc_name == "SAFER-SK") { if(name.size() != 2) throw Invalid_Algorithm_Name(algo_name); return new SAFER_SK(to_u32bit(name[1])); } if(bc_name == "RC5") { if(name.size() != 2) throw Invalid_Algorithm_Name(algo_name); return new RC5(to_u32bit(name[1])); } return 0; }/************************************************** Try to get a currently unloaded stream cipher **************************************************/StreamCipher* try_to_get_sc(const std::string& algo_name) { std::vector<std::string> name = parse_algorithm_name(algo_name); if(name.size() == 0) return 0; const std::string sc_name = deref_alias(name[0]); if(sc_name == "SEAL") { if(name.size() > 3) throw Invalid_Algorithm_Name(algo_name); if(name.size() == 1) return new SEAL; if(name.size() == 2) return new SEAL(to_u32bit(name[1])); if(name.size() == 3) return new SEAL(to_u32bit(name[1]), to_u32bit(name[2])); } return 0; }/************************************************** Try to get a currently unloaded hash **************************************************/HashFunction* try_to_get_hash(const std::string& algo_name) { std::vector<std::string> name = parse_algorithm_name(algo_name); if(name.size() == 0) return 0; const std::string hash_name = deref_alias(name[0]); if(hash_name == "HAVAL") { if(name.size() != 2) throw Invalid_Algorithm_Name(algo_name); return new HAVAL(to_u32bit(name[1])); } if(hash_name == "Parallel") { if(name.size() < 2) throw Invalid_Algorithm_Name(algo_name); name.erase(name.begin()); return new Parallel(name); } return 0; }/************************************************** Try to get a currently unloaded MAC **************************************************/MessageAuthenticationCode* try_to_get_mac(const std::string& algo_name) { std::vector<std::string> name = parse_algorithm_name(algo_name); if(name.size() == 0) return 0; const std::string mac_name = deref_alias(name[0]); if(mac_name == "EMAC") { if(name.size() != 2) throw Invalid_Algorithm_Name(algo_name); return new EMAC(name[1]); } if(mac_name == "HMAC") { if(name.size() != 2) throw Invalid_Algorithm_Name(algo_name); return new HMAC(name[1]); } return 0; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -