aboutsummaryrefslogtreecommitdiff
path: root/src/cryptopp/iterhash.h
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2011-05-09 14:04:24 -0400
committerGavin Andresen <gavinandresen@gmail.com>2011-05-09 14:04:24 -0400
commit91b8932eb1ff3a68d0d1e57bb43eaee3a6525f8b (patch)
tree13ebdb6bd67fae95fc30b6f76cdfd7cbe9971cce /src/cryptopp/iterhash.h
parent59d18adc4c2aaa5f24882e6c0cbeb43b47d80a80 (diff)
parentb17be7e14b4a62b7935c75fe7e7645e736fd68d2 (diff)
Merge branch 'master' of github.com:bitcoin/bitcoin
Diffstat (limited to 'src/cryptopp/iterhash.h')
-rw-r--r--src/cryptopp/iterhash.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/cryptopp/iterhash.h b/src/cryptopp/iterhash.h
new file mode 100644
index 0000000000..2f5895e2d3
--- /dev/null
+++ b/src/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