aboutsummaryrefslogtreecommitdiff
path: root/src/script.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-04-26 19:26:34 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2014-06-21 19:47:39 +0200
commit7b4737c87805b464cd47d01a9d814df5e41b8255 (patch)
tree152f8a981d9ccaddd8599ebe57ab395e9cc83cec /src/script.cpp
parent977cdadea8a77eed04f1f0fd341ba9dedc3fa783 (diff)
Switch script.cpp and hash.cpp to use sha2.cpp instead of OpenSSL.
Diffstat (limited to 'src/script.cpp')
-rw-r--r--src/script.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/script.cpp b/src/script.cpp
index 11cdfef950..f20c0bcca3 100644
--- a/src/script.cpp
+++ b/src/script.cpp
@@ -9,10 +9,13 @@
#include "hash.h"
#include "key.h"
#include "keystore.h"
+#include "sha2.h"
#include "sync.h"
#include "uint256.h"
#include "util.h"
+#include <openssl/sha.h>
+
#include <boost/foreach.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_comparison.hpp>
@@ -805,17 +808,11 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
else if (opcode == OP_SHA1)
SHA1(&vch[0], vch.size(), &vchHash[0]);
else if (opcode == OP_SHA256)
- SHA256(&vch[0], vch.size(), &vchHash[0]);
+ CSHA256().Write(&vch[0], vch.size()).Finalize(&vchHash[0]);
else if (opcode == OP_HASH160)
- {
- uint160 hash160 = Hash160(vch);
- memcpy(&vchHash[0], &hash160, sizeof(hash160));
- }
+ CHash160().Write(&vch[0], vch.size()).Finalize(&vchHash[0]);
else if (opcode == OP_HASH256)
- {
- uint256 hash = Hash(vch.begin(), vch.end());
- memcpy(&vchHash[0], &hash, sizeof(hash));
- }
+ CHash256().Write(&vch[0], vch.size()).Finalize(&vchHash[0]);
popstack(stack);
stack.push_back(vchHash);
}