diff options
author | lloyd <[email protected]> | 2006-05-18 18:33:19 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-05-18 18:33:19 +0000 |
commit | a2c99d3270eb73ef2db5704fc54356c6b75096f8 (patch) | |
tree | ad3d6c4fcc8dd0f403f8105598943616246fe172 /include/sha_64.h |
Initial checkin1.5.6
Diffstat (limited to 'include/sha_64.h')
-rw-r--r-- | include/sha_64.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/include/sha_64.h b/include/sha_64.h new file mode 100644 index 000000000..3ef999220 --- /dev/null +++ b/include/sha_64.h @@ -0,0 +1,55 @@ +/************************************************* +* SHA-{384,512} Header File * +* (C) 1999-2006 The Botan Project * +*************************************************/ + +#ifndef BOTAN_SHA_64BIT_H__ +#define BOTAN_SHA_64BIT_H__ + +#include <botan/mdx_hash.h> + +namespace Botan { + +/************************************************* +* SHA-{384,512} Base * +*************************************************/ +class SHA_64_BASE : public MDx_HashFunction + { + protected: + void clear() throw(); + SHA_64_BASE(u32bit out) : MDx_HashFunction(out, 128, true, true, 16) {} + SecureBuffer<u64bit, 8> digest; + private: + void hash(const byte[]); + void copy_out(byte[]); + + SecureBuffer<u64bit, 80> W; + }; + +/************************************************* +* SHA-384 * +*************************************************/ +class SHA_384 : public SHA_64_BASE + { + public: + void clear() throw(); + std::string name() const { return "SHA-384"; } + HashFunction* clone() const { return new SHA_384; } + SHA_384() : SHA_64_BASE(48) { clear(); } + }; + +/************************************************* +* SHA-512 * +*************************************************/ +class SHA_512 : public SHA_64_BASE + { + public: + void clear() throw(); + std::string name() const { return "SHA-512"; } + HashFunction* clone() const { return new SHA_512; } + SHA_512() : SHA_64_BASE(64) { clear(); } + }; + +} + +#endif |