Closed telamon closed 1 year ago
not sure what are you talking about, they both are 33b.
> (await import('@noble/curves/secp256k1')).secp256k1.getPublicKey(new Uint8Array(32).fill(1))
Uint8Array(33) [
3, 27, 132, 197, 86, 123, 18, 100,
64, 153, 93, 62, 213, 170, 186, 5,
101, 215, 30, 24, 52, 96, 72, 25,
255, 156, 23, 245, 233, 213, 221, 7,
143
]
> (await import('@noble/secp256k1')).getPublicKey(new Uint8Array(32).fill(1))
Uint8Array(33) [
3, 27, 132, 197, 86, 123, 18, 100,
64, 153, 93, 62, 213, 170, 186, 5,
101, 215, 30, 24, 52, 96, 72, 25,
255, 156, 23, 245, 233, 213, 221, 7,
143
]
@paulmillr Sorry i was zoomed in, but that is weird...
I can check which version of curves i migrated from but I am positive getPublickKey()
used to return out 32byte keys (without the id byte).
Closing the issue.
schnorr.getPublicKey
returns 32 bytes
@paulmillr i finally figured it out.. In the first example I was using the schnorr scheme from @noble/curves
which indeed are 32bytes.
Hence my original description is wrong, should have been: (@noble/curves/secp256k1).schnorr.getPublicKey(sk)
Apologies for the noise and thx for the help.
Hello I tried switching to this smaller repo from curves. But a test that used
getPublickKey()
failed:32bytes produced by
(@noble/curves).secp256k1.getPublicKey(sk)
33bytes produced by(@noble/secp256k1).get(publicKey(sk)
What's that first
03
byte? Can I discard it?EDIT after reading source, first byte is the compression-id/ y-coord
polarityparity; But what do i do with all existing 32byte keys? How was the y-coordpolarityparity decompressed before?