Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.6.0 breaks ethereumjs-devp2p #138

Closed
vpulim opened this issue Dec 28, 2018 · 2 comments
Closed

v3.6.0 breaks ethereumjs-devp2p #138

vpulim opened this issue Dec 28, 2018 · 2 comments

Comments

@vpulim
Copy link

vpulim commented Dec 28, 2018

Peers are no longer able to successfully handshake.

ecdhUnsafe() seems to be returning different values between 3.5.2 and 3.6.0

@fanatid
Copy link
Member

fanatid commented Dec 29, 2018

wow, do you have data for reproducing this issue?

@vpulim
Copy link
Author

vpulim commented Dec 29, 2018

Sure, here's some test code that I ran on 3.5.2 and 3.6.0 and got different results:

const secp256k1 = require('./index')
const publicKey = Buffer.from('03d0d06028880fac08fc7d481a87fca5845be7921ca83b49ed4697ca5c62b701c9', 'hex')
const privateKey = Buffer.from('9658d24d521e8f2d460722de887792441907079b4e76cdc341c3732600900477', 'hex')
console.log(secp256k1.ecdhUnsafe(publicKey, privateKey, true).toString('hex'))

3.5.2:

>> 033a353c2b6934e8746c363219eb718477a87cf5565eaa920db67258990b444d94

3.6.0:

>> 03944d440b995872b60d92aa5e56f57ca8778471eb1932366c74e834692b3c353a

NOTE: The keys were generated using test/util.js:

const privateKey = util.getPrivateKey()
const publicKey = util.getPublicKey(privateKey).compressed

Also, I ran the test using node LTS versions 6.16.0, 8.15.0 and 10.15.0 and all generated the same results.

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

No branches or pull requests

2 participants