aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2016-06-22 09:13:52 +0800
committerGitHub <noreply@github.com>2016-06-22 09:13:52 +0800
commit8a3131339734f4f98352ea3cc24971ed9ee0b16c (patch)
treed794056681d2642c036a7a8b9d3d582caead2c45 /app
parent03550b7e9a8462947a681d57d1ab15a0f596366d (diff)
parent856a7c84cd3b2a523b229088f3f657650c0a2b0f (diff)
downloadtangerine-wallet-browser-8a3131339734f4f98352ea3cc24971ed9ee0b16c.tar
tangerine-wallet-browser-8a3131339734f4f98352ea3cc24971ed9ee0b16c.tar.gz
tangerine-wallet-browser-8a3131339734f4f98352ea3cc24971ed9ee0b16c.tar.bz2
tangerine-wallet-browser-8a3131339734f4f98352ea3cc24971ed9ee0b16c.tar.lz
tangerine-wallet-browser-8a3131339734f4f98352ea3cc24971ed9ee0b16c.tar.xz
tangerine-wallet-browser-8a3131339734f4f98352ea3cc24971ed9ee0b16c.tar.zst
tangerine-wallet-browser-8a3131339734f4f98352ea3cc24971ed9ee0b16c.zip
Merge pull request #305 from MetaMask/FixEthSign
Fix eth sign with dennis' test input
Diffstat (limited to 'app')
-rw-r--r--app/scripts/lib/id-management.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/app/scripts/lib/id-management.js b/app/scripts/lib/id-management.js
index 30ea866f4..cc50bd649 100644
--- a/app/scripts/lib/id-management.js
+++ b/app/scripts/lib/id-management.js
@@ -69,10 +69,12 @@ function padWithZeroes (number, length) {
}
function concatSig (v, r, s) {
- r = padWithZeroes(ethUtil.fromSigned(r), 64)
- s = padWithZeroes(ethUtil.fromSigned(s), 64)
- r = ethUtil.stripHexPrefix(r.toString('hex'))
- s = ethUtil.stripHexPrefix(s.toString('hex'))
- v = ethUtil.stripHexPrefix(ethUtil.intToHex(v))
- return ethUtil.addHexPrefix(r.concat(s, v))
+ const rSig = ethUtil.fromSigned(r)
+ const sSig = ethUtil.fromSigned(s)
+ const vSig = ethUtil.bufferToInt(v)
+ const rStr = padWithZeroes(ethUtil.toUnsigned(rSig).toString('hex'), 64)
+ const sStr = padWithZeroes(ethUtil.toUnsigned(sSig).toString('hex'), 64)
+ const vStr = ethUtil.stripHexPrefix(ethUtil.intToHex(vSig))
+ return ethUtil.addHexPrefix(rStr.concat(sStr, vStr)).toString('hex')
}
+