static Gy = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n
static L: 32 = 32 // field / group byte length
- static L2: 64 = 64
- static pkLength: 33 = 33
+ static C: 33 = 33 // byte length of SEC1 compressed form of coordinate pair
// ## Helpers
// ----------
const tail = bytes.subarray(1)
const x = this.bytesToBigint(tail.subarray(0, this.L))
// No actual validation is done here: use .assertValidity()
- if (length === this.pkLength && (head === 0x02 || head === 0x03)) {
+ if (length === this.C && (head === 0x02 || head === 0x03)) {
// Equation is y² == x³ + ax + b. We calculate y from x.
// y = √y²; there are two solutions: y, -y. Determine proper solution based on prefix
let y = this.lift_x(x)
static isValidPublicKey (pk: Bytes): boolean {
try {
const l = pk.length
- if (l !== this.pkLength) return false
+ if (l !== this.C) return false
return !!this.pointFromBytes(pk)
} catch (error) {
return false