Botan
1.11.15
|
00001 /* 00002 * Keccak 00003 * (C) 2010 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #ifndef BOTAN_KECCAK_H__ 00009 #define BOTAN_KECCAK_H__ 00010 00011 #include <botan/hash.h> 00012 #include <botan/secmem.h> 00013 #include <string> 00014 00015 namespace Botan { 00016 00017 /** 00018 * Keccak[1600], a SHA-3 candidate 00019 */ 00020 class BOTAN_DLL Keccak_1600 : public HashFunction 00021 { 00022 public: 00023 00024 /** 00025 * @param output_bits the size of the hash output; must be one of 00026 * 224, 256, 384, or 512 00027 */ 00028 Keccak_1600(size_t output_bits = 512); 00029 00030 size_t hash_block_size() const { return bitrate / 8; } 00031 size_t output_length() const { return output_bits / 8; } 00032 00033 HashFunction* clone() const; 00034 std::string name() const; 00035 void clear(); 00036 private: 00037 void add_data(const byte input[], size_t length); 00038 void final_result(byte out[]); 00039 00040 size_t output_bits, bitrate; 00041 secure_vector<u64bit> S; 00042 size_t S_pos; 00043 }; 00044 00045 } 00046 00047 #endif