Closed cowboy9 closed 3 years ago
don't use secp256k1-native
, it's been downloaded like 5 times. Use other popular libraries and compare the result.
Which one do you prefer? @paulmillr
Hi @paulmillr , do you think the point
and scalar
value in my code are in right format to be used in secp.getSharedSecret
function?
point
is base64 value: A8Nd1J1A+akKMfHe7j8oZkfLf1QDOkTynN27zr9nBgK3 - public key B
scalar
is hex value: 88e5c2a323f371a43abee6ff28966f7f0cd267e65063aeba9033037c7d93d87d - private key A
const point = Buffer.from('A8Nd1J1A+akKMfHe7j8oZkfLf1QDOkTynN27zr9nBgK3', 'base64'); // B-JS public key
const scalar = Buffer.from('88e5c2a323f371a43abee6ff28966f7f0cd267e65063aeba9033037c7d93d87d', 'hex'); // A-JS private key
can these values used for getSharedSecret
function as params? Are these values in right format?
const sharedSecret = secp.getSharedSecret(scalar, point);
Any hex string
or Uint8Array
is valid. Buffers are not valid. You need to do Uint8Array.from(buffer)
.
Hi @paulmillr ,
I mean the point
variable is the base64
value which is 33
bytes and scalar
variable is hex
value which is 32
bytes in above code.
What are the byte size of params used in secp.getSharedSecret
function?
Sizes are correct. See noble-secp tests.
Hi @paulmillr , how can I change Point object to Buffer hex value?
See readme, Point.toHex(). Sorry, I don't really have time to be tech support if you don't know what you're doing! Compare outputs to other libraries and make it work.
Hi @paulmillr Thanks for creating a great module. By the way, I'm having some issues using this module. Could you help me? The following is the code to calculate sharedSecret using "secp256k1-native" npm module.
The result is "028c3425493529dddc51a5d2d2de8af9e68e5e835e883d687b4f2ec421a2640c", but it's different when I use "noble-secp256k1" module.
The above is my code. What's wrong in my code? My result length is 130. Could you help me? Thanks