Botan
1.11.15
|
00001 /* 00002 * SHA-{224,256} 00003 * (C) 1999-2011 Jack Lloyd 00004 * 2007 FlexSecure GmbH 00005 * 00006 * Botan is released under the Simplified BSD License (see license.txt) 00007 */ 00008 00009 #ifndef BOTAN_SHA_224_256_H__ 00010 #define BOTAN_SHA_224_256_H__ 00011 00012 #include <botan/mdx_hash.h> 00013 00014 namespace Botan { 00015 00016 /** 00017 * SHA-224 00018 */ 00019 class BOTAN_DLL SHA_224 : public MDx_HashFunction 00020 { 00021 public: 00022 std::string name() const { return "SHA-224"; } 00023 size_t output_length() const { return 28; } 00024 HashFunction* clone() const { return new SHA_224; } 00025 00026 void clear(); 00027 00028 SHA_224() : MDx_HashFunction(64, true, true), digest(8) 00029 { clear(); } 00030 private: 00031 void compress_n(const byte[], size_t blocks); 00032 void copy_out(byte[]); 00033 00034 secure_vector<u32bit> digest; 00035 }; 00036 00037 /** 00038 * SHA-256 00039 */ 00040 class BOTAN_DLL SHA_256 : public MDx_HashFunction 00041 { 00042 public: 00043 std::string name() const { return "SHA-256"; } 00044 size_t output_length() const { return 32; } 00045 HashFunction* clone() const { return new SHA_256; } 00046 00047 void clear(); 00048 00049 SHA_256() : MDx_HashFunction(64, true, true), digest(8) 00050 { clear(); } 00051 private: 00052 void compress_n(const byte[], size_t blocks); 00053 void copy_out(byte[]); 00054 00055 secure_vector<u32bit> digest; 00056 }; 00057 00058 } 00059 00060 #endif