diff --git a/CHANGELOG.md b/CHANGELOG.md index 13ec75666..1f498f2fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Remove nonfunctional QR code button. - Make network loading indicator clickable to select accessible network. - Show more characters of addresses when space permits. +- Fixed bug when signing messages under 64 hex characters long. ## 2.3.1 2016-06-09 diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index 33d842d54..e9b9e0e06 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), 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')