aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2011-10-05 10:38:10 -0400
committerGavin Andresen <gavinandresen@gmail.com>2011-10-05 10:38:10 -0400
commitb898c8fce687de9320bfae8dd2392e92c5464831 (patch)
tree0eae81bd8a40703143a5bbe74ce6648ca0b143c7 /src/main.cpp
parent8bc52d069247b3c7968bbb5c9ced9e6a7baa57e8 (diff)
parent452506fc4153be072fe443fe3e3cbf76d9563a42 (diff)
Merge branch 'no-cryptopp' of https://github.com/tcatm/bitcoin
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 750290ccc5..9c780e2040 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -6,7 +6,6 @@
#include "db.h"
#include "net.h"
#include "init.h"
-#include "cryptopp/sha.h"
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
@@ -2614,15 +2613,25 @@ int static FormatHashBlocks(void* pbuffer, unsigned int len)
return blocks;
}
-using CryptoPP::ByteReverse;
-
static const unsigned int pSHA256InitState[8] =
{0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
-inline void SHA256Transform(void* pstate, void* pinput, const void* pinit)
+void SHA256Transform(void* pstate, void* pinput, const void* pinit)
{
- memcpy(pstate, pinit, 32);
- CryptoPP::SHA256::Transform((CryptoPP::word32*)pstate, (CryptoPP::word32*)pinput);
+ SHA256_CTX ctx;
+ unsigned char data[64];
+
+ SHA256_Init(&ctx);
+
+ for (int i = 0; i < 16; i++)
+ ((uint32_t*)data)[i] = ByteReverse(((uint32_t*)pinput)[i]);
+
+ for (int i = 0; i < 8; i++)
+ ctx.h[i] = ((uint32_t*)pinit)[i];
+
+ SHA256_Update(&ctx, data, sizeof(data));
+ for (int i = 0; i < 8; i++)
+ ((uint32_t*)pstate)[i] = ctx.h[i];
}
//