From 3dd20ff2f87958a440c9dceae8abe3967aa48fcf Mon Sep 17 00:00:00 2001 From: --author=Satoshi Nakamoto Date: Tue, 27 Jul 2010 20:43:55 +0000 Subject: added a subset of Crypto++ 5.6.0 with 48% faster ASM SHA-256, combined speedup 2.5x faster vs 0.3.3, thanks BlackEye for figuring out the alignment problem --- cryptopp/iterhash.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 cryptopp/iterhash.h (limited to 'cryptopp/iterhash.h') diff --git a/cryptopp/iterhash.h b/cryptopp/iterhash.h new file mode 100644 index 0000000000..2f5895e2d3 --- /dev/null +++ b/cryptopp/iterhash.h @@ -0,0 +1,29 @@ +#ifndef CRYPTOPP_ITERHASH_H +#define CRYPTOPP_ITERHASH_H + +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +// *** trimmed down dependency from iterhash.h *** +template +class CRYPTOPP_NO_VTABLE IteratedHashWithStaticTransform +{ +public: + CRYPTOPP_CONSTANT(DIGESTSIZE = T_DigestSize ? T_DigestSize : T_StateSize) + unsigned int DigestSize() const {return DIGESTSIZE;}; + typedef T_HashWordType HashWordType; + CRYPTOPP_CONSTANT(BLOCKSIZE = T_BlockSize) + +protected: + IteratedHashWithStaticTransform() {this->Init();} + void HashEndianCorrectedBlock(const T_HashWordType *data) {T_Transform::Transform(this->m_state, data);} + void Init() {T_Transform::InitState(this->m_state);} + + T_HashWordType* StateBuf() {return this->m_state;} + FixedSizeAlignedSecBlock m_state; +}; + +NAMESPACE_END + +#endif -- cgit v1.2.3