From 1fe383f7fb82bf96e1709abb59ec25689e7a5bc7 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 14 Jun 2016 15:35:37 -0700 Subject: Fix signature concatenation Fixes #280 Or at least, it should. Is this what you were requesting, @denisgranha? --- app/scripts/lib/idStore.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'app/scripts') diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index 33d842d54..486c67be6 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -513,10 +513,17 @@ function IdManagement(opts) { function noop(){} +function pad_with_zeroes(number, length){ + var my_string = '' + number; + while (my_string.length < length) { + my_string = '0' + my_string; + } + return my_string; +} function concatSig(v, r, s) { - r = ethUtil.fromSigned(r) - s = ethUtil.fromSigned(s) + r = pad_with_zeroes(ethUtil.fromSigned(r)) + s = pad_with_zeroes(ethUtil.fromSigned(s)) v = ethUtil.bufferToInt(v) r = ethUtil.toUnsigned(r).toString('hex') s = ethUtil.toUnsigned(s).toString('hex') -- cgit v1.2.3 From 7430560f7fd9e9b3e7b8c4a2baaea6377a655734 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 14 Jun 2016 15:41:07 -0700 Subject: Fix pad with zeroes usage --- app/scripts/lib/idStore.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/scripts') diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index 486c67be6..e9b9e0e06 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -522,8 +522,8 @@ function pad_with_zeroes(number, length){ } function concatSig(v, r, s) { - r = pad_with_zeroes(ethUtil.fromSigned(r)) - s = pad_with_zeroes(ethUtil.fromSigned(s)) + r = pad_with_zeroes(ethUtil.fromSigned(r), 64) + s = pad_with_zeroes(ethUtil.fromSigned(s), 64) v = ethUtil.bufferToInt(v) r = ethUtil.toUnsigned(r).toString('hex') s = ethUtil.toUnsigned(s).toString('hex') -- cgit v1.2.3