]> git.codecow.com Git - nano25519.git/commitdiff
Move base2 out of base to avoid modifying it at this time since it is relatively...
authorChris Duncan <chris@codecow.com>
Fri, 21 Aug 2026 14:42:15 +0000 (07:42 -0700)
committerChris Duncan <chris@codecow.com>
Fri, 21 Aug 2026 14:42:15 +0000 (07:42 -0700)
src/assembly/base.ts
src/assembly/base2.ts [new file with mode: 0644]
src/assembly/ge.ts

index 24d189beec30855a9b01dc5f1f6eebfe479cbbfd..1dca656828ac1edb0d90d4ebb3ddd3ec456ece34 100644 (file)
@@ -1322,46 +1322,3 @@ const _base = StaticArray.fromArray<ge_precomp>([
                xy2d: StaticArray.fromArray<i32>([-20430234, 14955537, -24126347, 8124619, -5369288, -5990470, 30468147, -13900640, 18423289, 4177476, 0, 0]),
        },
 ])
-
-export const base2 = StaticArray.fromArray<ge_precomp>([
-       {
-               yplusx: StaticArray.fromArray<i32>([25967493, -14356035, 29566456, 3660896, -12694345, 4014787, 27544626, -11754271, -6079156, 2047605, 0, 0]),
-               yminusx: StaticArray.fromArray<i32>([-12545711, 934262, -2722910, 3049990, -727428, 9406986, 12720692, 5043384, 19500929, -15469378, 0, 0]),
-               xy2d: StaticArray.fromArray<i32>([-8738181, 4489570, 9688441, -14785194, 10184609, -12363380, 29287919, 11864899, -24514362, -4438546, 0, 0]),
-       },
-       {
-               yplusx: StaticArray.fromArray<i32>([15636291, -9688557, 24204773, -7912398, 616977, -16685262, 27787600, -14772189, 28944400, -1550024, 0, 0]),
-               yminusx: StaticArray.fromArray<i32>([16568933, 4717097, -11556148, -1102322, 15682896, -11807043, 16354577, -11775962, 7689662, 11199574, 0, 0]),
-               xy2d: StaticArray.fromArray<i32>([30464156, -5976125, -11779434, -15670865, 23220365, 15915852, 7512774, 10017326, -17749093, -9920357, 0, 0]),
-       },
-       {
-               yplusx: StaticArray.fromArray<i32>([10861363, 11473154, 27284546, 1981175, -30064349, 12577861, 32867885, 14515107, -15438304, 10819380, 0, 0]),
-               yminusx: StaticArray.fromArray<i32>([4708026, 6336745, 20377586, 9066809, -11272109, 6594696, -25653668, 12483688, -12668491, 5581306, 0, 0]),
-               xy2d: StaticArray.fromArray<i32>([19563160, 16186464, -29386857, 4097519, 10237984, -4348115, 28542350, 13850243, -23678021, -15815942, 0, 0]),
-       },
-       {
-               yplusx: StaticArray.fromArray<i32>([5153746, 9909285, 1723747, -2777874, 30523605, 5516873, 19480852, 5230134, -23952439, -15175766, 0, 0]),
-               yminusx: StaticArray.fromArray<i32>([-30269007, -3463509, 7665486, 10083793, 28475525, 1649722, 20654025, 16520125, 30598449, 7715701, 0, 0]),
-               xy2d: StaticArray.fromArray<i32>([28881845, 14381568, 9657904, 3680757, -20181635, 7843316, -31400660, 1370708, 29794553, -1409300, 0, 0]),
-       },
-       {
-               yplusx: StaticArray.fromArray<i32>([-22518993, -6692182, 14201702, -8745502, -23510406, 8844726, 18474211, -1361450, -13062696, 13821877, 0, 0]),
-               yminusx: StaticArray.fromArray<i32>([-6455177, -7839871, 3374702, -4740862, -27098617, -10571707, 31655028, -7212327, 18853322, -14220951, 0, 0]),
-               xy2d: StaticArray.fromArray<i32>([4566830, -12963868, -28974889, -12240689, -7602672, -2830569, -8514358, -10431137, 2207753, -3209784, 0, 0]),
-       },
-       {
-               yplusx: StaticArray.fromArray<i32>([-25154831, -4185821, 29681144, 7868801, -6854661, -9423865, -12437364, -663000, -31111463, -16132436, 0, 0]),
-               yminusx: StaticArray.fromArray<i32>([25576264, -2703214, 7349804, -11814844, 16472782, 9300885, 3844789, 15725684, 171356, 6466918, 0, 0]),
-               xy2d: StaticArray.fromArray<i32>([23103977, 13316479, 9739013, -16149481, 817875, -15038942, 8965339, -14088058, -30714912, 16193877, 0, 0]),
-       },
-       {
-               yplusx: StaticArray.fromArray<i32>([-33521811, 3180713, -2394130, 14003687, -16903474, -16270840, 17238398, 4729455, -18074513, 9256800, 0, 0]),
-               yminusx: StaticArray.fromArray<i32>([-25182317, -4174131, 32336398, 5036987, -21236817, 11360617, 22616405, 9761698, -19827198, 630305, 0, 0]),
-               xy2d: StaticArray.fromArray<i32>([-13720693, 2639453, -24237460, -7406481, 9494427, -5774029, -6554551, -15960994, -2449256, -14291300, 0, 0]),
-       },
-       {
-               yplusx: StaticArray.fromArray<i32>([-3151181, -5046075, 9282714, 6866145, -31907062, -863023, -18940575, 15033784, 25105118, -7894876, 0, 0]),
-               yminusx: StaticArray.fromArray<i32>([-24326370, 15950226, -31801215, -14592823, -11662737, -5090925, 1573892, -2625887, 2198790, -15804619, 0, 0]),
-               xy2d: StaticArray.fromArray<i32>([-3099351, 10324967, -2241613, 7453183, -5446979, -2735503, -13812022, -16236442, -32461234, -12290683, 0, 0]),
-       },
-])
diff --git a/src/assembly/base2.ts b/src/assembly/base2.ts
new file mode 100644 (file)
index 0000000..3fe972a
--- /dev/null
@@ -0,0 +1,47 @@
+//! SPDX-FileCopyrightText: 2013-2026 Frank Denis <j@pureftpd.org>
+//! SPDX-License-Identifier: ISC
+
+import { ge_precomp } from './p'
+
+export const base2 = StaticArray.fromArray<ge_precomp>([
+       {
+               yplusx: StaticArray.fromArray<i32>([25967493, -14356035, 29566456, 3660896, -12694345, 4014787, 27544626, -11754271, -6079156, 2047605, 0, 0]),
+               yminusx: StaticArray.fromArray<i32>([-12545711, 934262, -2722910, 3049990, -727428, 9406986, 12720692, 5043384, 19500929, -15469378, 0, 0]),
+               xy2d: StaticArray.fromArray<i32>([-8738181, 4489570, 9688441, -14785194, 10184609, -12363380, 29287919, 11864899, -24514362, -4438546, 0, 0]),
+       },
+       {
+               yplusx: StaticArray.fromArray<i32>([15636291, -9688557, 24204773, -7912398, 616977, -16685262, 27787600, -14772189, 28944400, -1550024, 0, 0]),
+               yminusx: StaticArray.fromArray<i32>([16568933, 4717097, -11556148, -1102322, 15682896, -11807043, 16354577, -11775962, 7689662, 11199574, 0, 0]),
+               xy2d: StaticArray.fromArray<i32>([30464156, -5976125, -11779434, -15670865, 23220365, 15915852, 7512774, 10017326, -17749093, -9920357, 0, 0]),
+       },
+       {
+               yplusx: StaticArray.fromArray<i32>([10861363, 11473154, 27284546, 1981175, -30064349, 12577861, 32867885, 14515107, -15438304, 10819380, 0, 0]),
+               yminusx: StaticArray.fromArray<i32>([4708026, 6336745, 20377586, 9066809, -11272109, 6594696, -25653668, 12483688, -12668491, 5581306, 0, 0]),
+               xy2d: StaticArray.fromArray<i32>([19563160, 16186464, -29386857, 4097519, 10237984, -4348115, 28542350, 13850243, -23678021, -15815942, 0, 0]),
+       },
+       {
+               yplusx: StaticArray.fromArray<i32>([5153746, 9909285, 1723747, -2777874, 30523605, 5516873, 19480852, 5230134, -23952439, -15175766, 0, 0]),
+               yminusx: StaticArray.fromArray<i32>([-30269007, -3463509, 7665486, 10083793, 28475525, 1649722, 20654025, 16520125, 30598449, 7715701, 0, 0]),
+               xy2d: StaticArray.fromArray<i32>([28881845, 14381568, 9657904, 3680757, -20181635, 7843316, -31400660, 1370708, 29794553, -1409300, 0, 0]),
+       },
+       {
+               yplusx: StaticArray.fromArray<i32>([-22518993, -6692182, 14201702, -8745502, -23510406, 8844726, 18474211, -1361450, -13062696, 13821877, 0, 0]),
+               yminusx: StaticArray.fromArray<i32>([-6455177, -7839871, 3374702, -4740862, -27098617, -10571707, 31655028, -7212327, 18853322, -14220951, 0, 0]),
+               xy2d: StaticArray.fromArray<i32>([4566830, -12963868, -28974889, -12240689, -7602672, -2830569, -8514358, -10431137, 2207753, -3209784, 0, 0]),
+       },
+       {
+               yplusx: StaticArray.fromArray<i32>([-25154831, -4185821, 29681144, 7868801, -6854661, -9423865, -12437364, -663000, -31111463, -16132436, 0, 0]),
+               yminusx: StaticArray.fromArray<i32>([25576264, -2703214, 7349804, -11814844, 16472782, 9300885, 3844789, 15725684, 171356, 6466918, 0, 0]),
+               xy2d: StaticArray.fromArray<i32>([23103977, 13316479, 9739013, -16149481, 817875, -15038942, 8965339, -14088058, -30714912, 16193877, 0, 0]),
+       },
+       {
+               yplusx: StaticArray.fromArray<i32>([-33521811, 3180713, -2394130, 14003687, -16903474, -16270840, 17238398, 4729455, -18074513, 9256800, 0, 0]),
+               yminusx: StaticArray.fromArray<i32>([-25182317, -4174131, 32336398, 5036987, -21236817, 11360617, 22616405, 9761698, -19827198, 630305, 0, 0]),
+               xy2d: StaticArray.fromArray<i32>([-13720693, 2639453, -24237460, -7406481, 9494427, -5774029, -6554551, -15960994, -2449256, -14291300, 0, 0]),
+       },
+       {
+               yplusx: StaticArray.fromArray<i32>([-3151181, -5046075, 9282714, 6866145, -31907062, -863023, -18940575, 15033784, 25105118, -7894876, 0, 0]),
+               yminusx: StaticArray.fromArray<i32>([-24326370, 15950226, -31801215, -14592823, -11662737, -5090925, 1573892, -2625887, 2198790, -15804619, 0, 0]),
+               xy2d: StaticArray.fromArray<i32>([-3099351, 10324967, -2241613, 7453183, -5446979, -2735503, -13812022, -16236442, -32461234, -12290683, 0, 0]),
+       },
+])
index 4438c6a3b63f674fbfa5a54b6d844f1a818c52d3..cad006ae6b7f70e7f3da584de081019b17226600 100644 (file)
@@ -16,7 +16,8 @@
  * - ge_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T
  * - ge_precomp (Duif): (y+x,y-x,2dxy)
 */
-import { base, base2 } from './base'
+import { base } from './base'
+import { base2 } from './base2'
 import { ed25519_d, fe25519_sqrtm1 } from './constants'
 import { FieldElement, fe, fe_1, fe_add, fe_cmov, fe_copy, fe_frombytes, fe_isnegative, fe_iszero, fe_mul, fe_neg, fe_pow22523, fe_sq, fe_sub } from './fe'
 import { ge_add_cached, ge_add_precomp, ge_cached, ge_p1p1, ge_p1p1_to_p2, ge_p1p1_to_p3, ge_p2, ge_p2_0, ge_p2_dbl, ge_p2_to_p3, ge_p3, ge_p3_0, ge_p3_dbl, ge_p3_to_cached, ge_p3_tobytes, ge_precomp, ge_precomp_0, ge_sub_cached, ge_sub_precomp } from './p'