Skip to content

Instantly share code, notes, and snippets.

@csquared
Created March 16, 2014 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csquared/9588782 to your computer and use it in GitHub Desktop.
Save csquared/9588782 to your computer and use it in GitHub Desktop.
commit 6e98738c32e2a4975fcdbc61114f9d071d671995
Author: Chris Continanza <christopher.continanza@gmail.com>
Date: Sun Mar 16 12:42:27 2014 -0700
fix sign
diff --git a/ecdsa.cpp b/ecdsa.cpp
index ff9d534..a26ad2f 100644
--- a/ecdsa.cpp
+++ b/ecdsa.cpp
@@ -208,10 +208,14 @@ int ecdsa_sign(const uint8_t *priv_key, const uint8_t *msg, uint32_t msg_len, ui
bignum256 k, z;
bignum256 *da = &R.y;
// compute hash function of message
- SHA256_Raw(msg, msg_len, hash);
+ // SHA256_Raw(msg, msg_len, hash);
// if double hash is required uncomment the following line:
// SHA256_Raw(hash, 32, hash);
+ //we're already getting it double-hashed so i'm just
+ //copying the data directly into "hash"
+ memcpy(hash, msg, msg_len);
+
bn_read_be(hash, &z);
#if USE_RFC6979
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment