private static void ge_p3_dbl(ref ge_p1p1 r, ge_p3 p) { ge_p2 q = new() { X = stackalloc int[10], Y = stackalloc int[10], Z = stackalloc int[10], }; ge_p1p1 result = new() { X = stackalloc int[10], Y = stackalloc int[10], Z = stackalloc int[10], T = stackalloc int[10], }; r.X.CopyTo(result.X); r.Y.CopyTo(result.Y); r.Z.CopyTo(result.Z); r.T.CopyTo(result.T); ge_p3_to_p2(ref q, p); ge_p2_dbl(ref result, q); result.X.CopyTo(r.X); result.Y.CopyTo(r.Y); result.Z.CopyTo(r.Z); result.T.CopyTo(r.T); }
private static void ge_p1p1_to_p3(ref ge_p3 r, ge_p1p1 p) { ge_p3 result = new() { X = stackalloc int[10], Y = stackalloc int[10], Z = stackalloc int[10], T = stackalloc int[10], }; r.X.CopyTo(result.X); r.Y.CopyTo(result.Y); r.Z.CopyTo(result.Z); r.T.CopyTo(result.T); fe_mul(ref result.X, p.X, p.T); fe_mul(ref result.Y, p.Y, p.Z); fe_mul(ref result.Z, p.Z, p.T); fe_mul(ref result.T, p.X, p.Y); result.X.CopyTo(r.X); result.Y.CopyTo(r.Y); result.Z.CopyTo(r.Z); result.T.CopyTo(r.T); }
private static void ge_p2_dbl(ref ge_p1p1 r, ge_p2 p) { Span <int> t0 = stackalloc int[10]; ge_p1p1 result = new() { X = stackalloc int[10], Y = stackalloc int[10], Z = stackalloc int[10], T = stackalloc int[10], }; r.X.CopyTo(result.X); r.Y.CopyTo(result.Y); r.Z.CopyTo(result.Z); r.T.CopyTo(result.T); fe_sq(ref result.X, p.X); fe_sq(ref result.Z, p.Y); fe_sq2(ref result.T, p.Z); fe_add(ref result.Y, p.X, p.Y); fe_sq(ref t0, result.Y); fe_add(ref result.Y, result.Z, result.X); fe_sub(ref result.Z, result.Z, result.X); fe_sub(ref result.X, t0, result.Y); fe_sub(ref result.T, result.T, result.Z); result.X.CopyTo(r.X); result.Y.CopyTo(r.Y); result.Z.CopyTo(r.Z); result.T.CopyTo(r.T); }
private static void ge_msub(ref ge_p1p1 r, ge_p3 p, ge_precomp q) { Span <int> t0 = stackalloc int[10]; ge_p1p1 result = new() { X = stackalloc int[10], Y = stackalloc int[10], Z = stackalloc int[10], T = stackalloc int[10], }; r.X.CopyTo(result.X); r.Y.CopyTo(result.Y); r.Z.CopyTo(result.Z); r.T.CopyTo(result.T); fe_add(ref result.X, p.Y, p.X); fe_sub(ref result.Y, p.Y, p.X); fe_mul(ref result.Z, result.X, q.yminusx); fe_mul(ref result.Y, result.Y, q.yplusx); fe_mul(ref result.T, q.xy2d, p.T); fe_add(ref t0, p.Z, p.Z); fe_sub(ref result.X, result.Z, result.Y); fe_add(ref result.Y, result.Z, result.Y); fe_sub(ref result.Z, t0, result.T); fe_add(ref result.T, t0, result.T); result.X.CopyTo(r.X); result.Y.CopyTo(r.Y); result.Z.CopyTo(r.Z); result.T.CopyTo(r.T); }