static crypto_sign_PRIVATEKEYBYTES: 32 = 32\r
static crypto_sign_SEEDBYTES: 32 = 32\r
\r
- static gf (init: number[] = []): Float64Array {\r
- const r = new Float64Array(16)\r
- r.set(init)\r
- return r\r
- }\r
-\r
static gf4 (): Float64Array[] {\r
return [new Float64Array(16), new Float64Array(16), new Float64Array(16), new Float64Array(16)]\r
}\r
\r
static pack25519 (o: Uint8Array, n: Float64Array): void {\r
let b: number\r
- const m: Float64Array = this.gf()\r
- const t: Float64Array = this.gf()\r
+ const m: Float64Array = new Float64Array(16)\r
+ const t: Float64Array = new Float64Array(16)\r
t.set(n.subarray(0, 16), 0)\r
this.car25519(t)\r
this.car25519(t)\r
}\r
\r
static pow2523 (o: Float64Array, i: Float64Array): void {\r
- const c: Float64Array = this.gf()\r
+ const c: Float64Array = new Float64Array(16)\r
c.set(i.subarray(0, 16), 0)\r
for (let a = 250; a >= 0; a--) {\r
this.Square(c, c)\r
}\r
\r
static add (p: Float64Array[], q: Float64Array[]): void {\r
- const a: Float64Array = this.gf()\r
- const b: Float64Array = this.gf()\r
- const c: Float64Array = this.gf()\r
- const d: Float64Array = this.gf()\r
- const e: Float64Array = this.gf()\r
- const f: Float64Array = this.gf()\r
- const g: Float64Array = this.gf()\r
- const h: Float64Array = this.gf()\r
- const t: Float64Array = this.gf()\r
+ const a: Float64Array = new Float64Array(16)\r
+ const b: Float64Array = new Float64Array(16)\r
+ const c: Float64Array = new Float64Array(16)\r
+ const d: Float64Array = new Float64Array(16)\r
+ const e: Float64Array = new Float64Array(16)\r
+ const f: Float64Array = new Float64Array(16)\r
+ const g: Float64Array = new Float64Array(16)\r
+ const h: Float64Array = new Float64Array(16)\r
+ const t: Float64Array = new Float64Array(16)\r
\r
this.Subtract(a, p[1], p[0])\r
this.Subtract(t, q[1], q[0])\r
}\r
\r
static pack (r: Uint8Array, p: Float64Array[]): void {\r
- const tx: Float64Array = this.gf()\r
- const ty: Float64Array = this.gf()\r
- const zi: Float64Array = this.gf()\r
+ const tx: Float64Array = new Float64Array(16)\r
+ const ty: Float64Array = new Float64Array(16)\r
+ const zi: Float64Array = new Float64Array(16)\r
this.inv25519(zi, p[2])\r
this.Multiply(tx, p[0], zi)\r
this.Multiply(ty, p[1], zi)\r
}\r
\r
static unpackneg (r: Float64Array[], p: Uint8Array): -1 | 0 {\r
- const t: Float64Array = this.gf()\r
- const chk: Float64Array = this.gf()\r
- const num: Float64Array = this.gf()\r
- const den: Float64Array = this.gf()\r
- const den2: Float64Array = this.gf()\r
- const den4: Float64Array = this.gf()\r
- const den6: Float64Array = this.gf()\r
+ const t: Float64Array = new Float64Array(16)\r
+ const chk: Float64Array = new Float64Array(16)\r
+ const num: Float64Array = new Float64Array(16)\r
+ const den: Float64Array = new Float64Array(16)\r
+ const den2: Float64Array = new Float64Array(16)\r
+ const den4: Float64Array = new Float64Array(16)\r
+ const den6: Float64Array = new Float64Array(16)\r
\r
r[2].fill(0).set([1], 0)\r
this.unpack25519(r[1], p)\r
if (this.neq25519(chk, num)) return -1\r
\r
if (this.par25519(r[0]) === (p[31] >> 7)) {\r
- this.Subtract(r[0], this.gf(), r[0])\r
+ this.Subtract(r[0], new Float64Array(16), r[0])\r
}\r
this.Multiply(r[3], r[0], r[1])\r
return 0\r