1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

Merge pull request #289 from MetaMask/FixSignatureConcatenation

Fix signature concatenation
This commit is contained in:
Dan Finlay 2016-06-14 15:42:47 -07:00 committed by GitHub
commit a4b87b3625
2 changed files with 10 additions and 2 deletions

View File

@ -6,6 +6,7 @@
- Remove nonfunctional QR code button. - Remove nonfunctional QR code button.
- Make network loading indicator clickable to select accessible network. - Make network loading indicator clickable to select accessible network.
- Show more characters of addresses when space permits. - Show more characters of addresses when space permits.
- Fixed bug when signing messages under 64 hex characters long.
## 2.3.1 2016-06-09 ## 2.3.1 2016-06-09

View File

@ -513,10 +513,17 @@ function IdManagement(opts) {
function noop(){} 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) { function concatSig(v, r, s) {
r = ethUtil.fromSigned(r) r = pad_with_zeroes(ethUtil.fromSigned(r), 64)
s = ethUtil.fromSigned(s) s = pad_with_zeroes(ethUtil.fromSigned(s), 64)
v = ethUtil.bufferToInt(v) v = ethUtil.bufferToInt(v)
r = ethUtil.toUnsigned(r).toString('hex') r = ethUtil.toUnsigned(r).toString('hex')
s = ethUtil.toUnsigned(s).toString('hex') s = ethUtil.toUnsigned(s).toString('hex')