bitcoinjs / tiny-secp256k1

A tiny secp256k1 native/JS wrapper
MIT License
92 stars 55 forks source link

Difference between native and js of isPoint #27

Closed madeken closed 5 years ago

madeken commented 5 years ago

From my repl session:

$ node
> const ecc = require('tiny-secp256k1')
undefined
> const ecc2 = require('tiny-secp256k1/ecurve')
undefined
> b = Buffer.from('020045400697100007000037899988826500030092003000016366806305909050','hex')
<Buffer 02 00 45 40 06 97 10 00 07 00 00 37 89 99 88 82 65 00 03 00 92 00 30 00 01 63 66 80 63 05 90 90 50>
> ecc.isPoint(b)
false
> ecc2.isPoint(b)
true
junderw commented 5 years ago

What is the version you are using (check with node -v)

$ node -v
v10.13.0
$ node
> const ecc = require('tiny-secp256k1')
undefined
> const ecc2 = require('tiny-secp256k1/ecurve')
undefined
> b = Buffer.from('020045400697100007000037899988826500030092003000016366806305909050','hex')
<Buffer 02 00 45 40 06 97 10 00 07 00 00 37 89 99 88 82 65 00 03 00 92 00 30 00 01 63 66 80 63 05 90 90 50>
> ecc.isPoint(b)
true
> ecc2.isPoint(b)
true
> 
(To exit, press ^C again or type .exit)
> 
$ nvm use v6
Now using node v6.11.1 (npm v3.10.10)
$ node
> const ecc = require('tiny-secp256k1')
undefined
> const ecc2 = require('tiny-secp256k1/ecurve')
undefined
> b = Buffer.from('020045400697100007000037899988826500030092003000016366806305909050','hex')
<Buffer 02 00 45 40 06 97 10 00 07 00 00 37 89 99 88 82 65 00 03 00 92 00 30 00 01 63 66 80 63 05 90 90 50>
> ecc.isPoint(b)
true
> ecc2.isPoint(b)
true
junderw commented 5 years ago

Also, since the problem is with native bindings... tell us more about your environment.

OS? Compiler for Node native bindings? (Windows: Visual Studio 2017 CE?)

etc.

dcousens commented 5 years ago

Reproduced. See https://github.com/bitcoinjs/tiny-secp256k1/pull/28

junderw commented 5 years ago

Reproduced. needed tiny-secp256k1@1.0.1

$ node -v
v11.1.0
$ node
> const ecc = require('tiny-secp256k1')
undefined
> const ecc2 = require('tiny-secp256k1/ecurve')
undefined
> let path = require.resolve('tiny-secp256k1')
undefined
> path = path.replace(/index.js$/, 'package.json')
'/home/jonathan/node_modules/tiny-secp256k1/package.json'
> const pjson = require(path)
undefined
> pjson.version
'1.0.1'
> b = Buffer.from('020045400697100007000037899988826500030092003000016366806305909050','hex')
<Buffer 02 00 45 40 06 97 10 00 07 00 00 37 89 99 88 82 65 00 03 00 92 00 30 00 01 63 66 80 63 05 90 90 50>
> ecc.isPoint(b)
false
> ecc2.isPoint(b)
true
dcousens commented 5 years ago

See #28