return this.vn(x, xi, y, yi, 32)\r
}\r
\r
- static set25519 (r: Float64Array, a: Float64Array): void {\r
- for (let i = 0; i < 16; i++) {\r
- r[i] = a[i] | 0\r
- }\r
- }\r
-\r
static car25519 (o: Float64Array): void {\r
let v, c = 1\r
for (let i = 0; i < 16; i++) {\r
}\r
\r
static scalarmult (p: Float64Array[], q: Float64Array[], s: Uint8Array): void {\r
- this.set25519(p[0], this.gf())\r
- this.set25519(p[1], this.gf([1]))\r
- this.set25519(p[2], this.gf([1]))\r
- this.set25519(p[3], this.gf())\r
+ p[0].fill(0)\r
+ p[1].fill(0).set([1], 0)\r
+ p[2].fill(0).set([1], 0)\r
+ p[3].fill(0)\r
for (let i = 255; i >= 0; --i) {\r
const b = (s[(i / 8) | 0] >> (i & 7)) & 1\r
this.cswap(p, q, b)\r
\r
static scalarbase (p: Float64Array[], s: Uint8Array): void {\r
const q: Float64Array[] = this.gf4()\r
- this.set25519(q[0], this.X)\r
- this.set25519(q[1], this.Y)\r
- this.set25519(q[2], this.gf([1]))\r
- this.set25519(q[3], this.XY)\r
+ q[0].set(this.X, 0)\r
+ q[1].set(this.Y, 0)\r
+ q[2].set([1], 0)\r
+ q[3].set(this.XY, 0)\r
this.scalarmult(p, q, s)\r
}\r
\r
const den4: Float64Array = this.gf()\r
const den6: Float64Array = this.gf()\r
\r
- this.set25519(r[2], this.gf([1]))\r
+ r[2].fill(0).set([1], 0)\r
this.unpack25519(r[1], p)\r
this.Square(num, r[1])\r
this.Multiply(den, num, this.D)\r
\r
if (this.neq25519(chk, num)) return -1\r
\r
- if (this.par25519(r[0]) === (p[31] >> 7)) this.Subtract(r[0], this.gf(), r[0])\r
+ if (this.par25519(r[0]) === (p[31] >> 7)) {\r
+ this.Subtract(r[0], this.gf(), r[0])\r
+ }\r
this.Multiply(r[3], r[0], r[1])\r
return 0\r
}\r