aboutsummaryrefslogtreecommitdiff
path: root/cryptopp/iterhash.h
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-07-27 18:14:32 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-07-27 18:14:32 +0000
commit813505cc1313b7e191b787f93e573acb91fa1464 (patch)
tree4a6de5a8fb3a54a2e68153ee773d6fd93c93769b /cryptopp/iterhash.h
parent520f3673196dd6517982e3f662cf62afda368341 (diff)
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
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@114 1a98c847-1fd6-4fd8-948a-caf3550aa51b
Diffstat (limited to 'cryptopp/iterhash.h')
-rw-r--r--cryptopp/iterhash.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/cryptopp/iterhash.h b/cryptopp/iterhash.h
new file mode 100644
index 0000000000..3de8da505b
--- /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 T_HashWordType, class T_Endianness, unsigned int T_BlockSize, unsigned int T_StateSize, class T_Transform, unsigned int T_DigestSize = 0, bool T_StateAligned = false>
+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<T_HashWordType, T_BlockSize/sizeof(T_HashWordType), T_StateAligned> m_state;
+};
+
+NAMESPACE_END
+
+#endif