aboutsummaryrefslogtreecommitdiff
path: root/src/rpcwallet.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2012-10-19 23:13:44 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2012-10-19 23:18:07 +0200
commit8980a509240107730eae8b517d80b444d1e31ccd (patch)
treef9e79d9357cc8171bab6314d14ef59ef3d3f2376 /src/rpcwallet.cpp
parent485d667748b776a1932e3e14dc1b9dfe2ba841d0 (diff)
Use CHashWriter also in SignatureHash(), and for message signing
Diffstat (limited to 'src/rpcwallet.cpp')
-rw-r--r--src/rpcwallet.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp
index cc2e8ab46b..6f8728e979 100644
--- a/src/rpcwallet.cpp
+++ b/src/rpcwallet.cpp
@@ -329,12 +329,12 @@ Value signmessage(const Array& params, bool fHelp)
if (!pwalletMain->GetKey(keyID, key))
throw JSONRPCError(RPC_WALLET_ERROR, "Private key not available");
- CDataStream ss(SER_GETHASH, 0);
+ CHashWriter ss(SER_GETHASH, 0);
ss << strMessageMagic;
ss << strMessage;
vector<unsigned char> vchSig;
- if (!key.SignCompact(Hash(ss.begin(), ss.end()), vchSig))
+ if (!key.SignCompact(ss.GetHash(), vchSig))
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Sign failed");
return EncodeBase64(&vchSig[0], vchSig.size());
@@ -365,12 +365,12 @@ Value verifymessage(const Array& params, bool fHelp)
if (fInvalid)
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Malformed base64 encoding");
- CDataStream ss(SER_GETHASH, 0);
+ CHashWriter ss(SER_GETHASH, 0);
ss << strMessageMagic;
ss << strMessage;
CKey key;
- if (!key.SetCompactSignature(Hash(ss.begin(), ss.end()), vchSig))
+ if (!key.SetCompactSignature(ss.GetHash(), vchSig))
return false;
return (key.GetPubKey().GetID() == keyID);