Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Serialize message signatures #36

Closed
kumavis opened this issue Apr 27, 2016 · 4 comments
Closed

Serialize message signatures #36

kumavis opened this issue Apr 27, 2016 · 4 comments
Assignees

Comments

@kumavis
Copy link
Member

kumavis commented Apr 27, 2016

they come out in this format:

function concatSig(v, r, s) {
  r = ethUtil.fromSigned(r)
  s = ethUtil.fromSigned(s)
  v = ethUtil.bufferToInt(v)
  r = ethUtil.toUnsigned(r).toString('hex')
  s = ethUtil.toUnsigned(s).toString('hex')
  v = ethUtil.stripHexPrefix(ethUtil.intToHex(v))
  return ethUtil.addHexPrefix(r.concat(s, v).toString("hex"))
}
@kumavis kumavis self-assigned this May 2, 2016
@axic
Copy link
Member

axic commented May 2, 2016

@fanatid are r and s in two's complement format in secp256k1.sign()?

@kumavis I don't think the above should need to use fromSigned/toUnsigned conversion. Also it converts it to the format the new geth is using (the one uses v-27).

@kumavis
Copy link
Member Author

kumavis commented May 2, 2016

this is just copy pasta from lightwallet https://github.com/ConsenSys/eth-lightwallet/blob/master/lib/signing.js
sorry im not very familiar with this one

@kumavis
Copy link
Member Author

kumavis commented May 3, 2016

obv we should include a verify method

@fanatid
Copy link
Contributor

fanatid commented May 3, 2016

@axic secp256k1.sign return r/s as unsigned numbers that lower than n (FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants