public static void Invert(ulong[] x, ulong[] z) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (Nat192.IsZero64(x)) { throw new InvalidOperationException(); } ulong[] array = Nat192.Create64(); ulong[] array2 = Nat192.Create64(); Square(x, array); Multiply(array, x, array); SquareN(array, 2, array2); Multiply(array2, array, array2); SquareN(array2, 4, array); Multiply(array, array2, array); SquareN(array, 8, array2); Multiply(array2, array, array2); SquareN(array2, 16, array); Multiply(array, array2, array); SquareN(array, 32, array2); Multiply(array2, array, array2); Square(array2, array2); Multiply(array2, x, array2); SquareN(array2, 65, array); Multiply(array, array2, array); Square(array, z); }
public static void Invert(ulong[] x, ulong[] z) { if (Nat192.IsZero64(x)) { throw new InvalidOperationException(); } ulong[] numArray = Nat192.Create64(); ulong[] numArray2 = Nat192.Create64(); Square(x, numArray); Multiply(numArray, x, numArray); SquareN(numArray, 2, numArray2); Multiply(numArray2, numArray, numArray2); SquareN(numArray2, 4, numArray); Multiply(numArray, numArray2, numArray); SquareN(numArray, 8, numArray2); Multiply(numArray2, numArray, numArray2); SquareN(numArray2, 0x10, numArray); Multiply(numArray, numArray2, numArray); SquareN(numArray, 0x20, numArray2); Multiply(numArray2, numArray, numArray2); Square(numArray2, numArray2); Multiply(numArray2, x, numArray2); SquareN(numArray2, 0x41, numArray); Multiply(numArray, numArray2, numArray); Square(numArray, z); }
public static void Invert(ulong[] x, ulong[] z) { if (Nat192.IsZero64(x)) { throw new InvalidOperationException(); } // Itoh-Tsujii inversion ulong[] t0 = Nat192.Create64(); ulong[] t1 = Nat192.Create64(); Square(x, t0); Multiply(t0, x, t0); SquareN(t0, 2, t1); Multiply(t1, t0, t1); SquareN(t1, 4, t0); Multiply(t0, t1, t0); SquareN(t0, 8, t1); Multiply(t1, t0, t1); SquareN(t1, 16, t0); Multiply(t0, t1, t0); SquareN(t0, 32, t1); Multiply(t1, t0, t1); Square(t1, t1); Multiply(t1, x, t1); SquareN(t1, 65, t0); Multiply(t0, t1, t0); Square(t0, z); }
public override ECFieldElement SquarePow(int pow) { if (pow < 1) { return(this); } ulong[] z = Nat192.Create64(); SecT131Field.SquareN(x, pow, z); return(new SecT131FieldElement(z)); }
public override ECFieldElement SquarePlusProduct(ECFieldElement x, ECFieldElement y) { ulong[] numArray = this.x; ulong[] numArray2 = ((SecT163FieldElement)x).x; ulong[] numArray3 = ((SecT163FieldElement)y).x; ulong[] zz = Nat192.CreateExt64(); SecT163Field.SquareAddToExt(numArray, zz); SecT163Field.MultiplyAddToExt(numArray2, numArray3, zz); ulong[] z = Nat192.Create64(); SecT163Field.Reduce(zz, z); return(new SecT163FieldElement(z)); }
public override ECFieldElement SquarePlusProduct(ECFieldElement x, ECFieldElement y) { ulong[] array = this.x; ulong[] array2 = ((SecT131FieldElement)x).x; ulong[] y2 = ((SecT131FieldElement)y).x; ulong[] array3 = Nat.Create64(5); SecT131Field.SquareAddToExt(array, array3); SecT131Field.MultiplyAddToExt(array2, y2, array3); ulong[] z = Nat192.Create64(); SecT131Field.Reduce(array3, z); return(new SecT131FieldElement(z)); }
public override ECPoint LookupVar(int index) { ulong[] x = Nat192.Create64(), y = Nat192.Create64(); int pos = index * SECT163R2_FE_LONGS * 2; for (int j = 0; j < SECT163R2_FE_LONGS; ++j) { x[j] = m_table[pos + j]; y[j] = m_table[pos + SECT163R2_FE_LONGS + j]; } return(CreatePoint(x, y)); }
public override ECFieldElement MultiplyPlusProduct(ECFieldElement b, ECFieldElement x, ECFieldElement y) { ulong[] numArray = this.x; ulong[] numArray2 = ((SecT131FieldElement)b).x; ulong[] numArray3 = ((SecT131FieldElement)x).x; ulong[] numArray4 = ((SecT131FieldElement)y).x; ulong[] zz = Nat.Create64(5); SecT131Field.MultiplyAddToExt(numArray, numArray2, zz); SecT131Field.MultiplyAddToExt(numArray3, numArray4, zz); ulong[] z = Nat192.Create64(); SecT131Field.Reduce(zz, z); return(new SecT131FieldElement(z)); }
public override ECFieldElement MultiplyPlusProduct(ECFieldElement b, ECFieldElement x, ECFieldElement y) { ulong[] ax = this.x, bx = ((SecT131FieldElement)b).x; ulong[] xx = ((SecT131FieldElement)x).x, yx = ((SecT131FieldElement)y).x; ulong[] tt = Nat.Create64(5); SecT131Field.MultiplyAddToExt(ax, bx, tt); SecT131Field.MultiplyAddToExt(xx, yx, tt); ulong[] z = Nat192.Create64(); SecT131Field.Reduce(tt, z); return(new SecT131FieldElement(z)); }
public override ECFieldElement MultiplyPlusProduct(ECFieldElement b, ECFieldElement x, ECFieldElement y) { ulong[] array = this.x; ulong[] y2 = ((SecT163FieldElement)b).x; ulong[] array2 = ((SecT163FieldElement)x).x; ulong[] y3 = ((SecT163FieldElement)y).x; ulong[] array3 = Nat192.CreateExt64(); SecT163Field.MultiplyAddToExt(array, y2, array3); SecT163Field.MultiplyAddToExt(array2, y3, array3); ulong[] z = Nat192.Create64(); SecT163Field.Reduce(array3, z); return(new SecT163FieldElement(z)); }
public static void Sqrt(ulong[] x, ulong[] z) { ulong[] numArray = Nat192.Create64(); ulong num = Interleave.Unshuffle(x[0]); ulong num2 = Interleave.Unshuffle(x[1]); ulong num3 = (num & 0xffffffffL) | (num2 << 0x20); numArray[0] = (num >> 0x20) | (num2 & 18_446_744_069_414_584_320L); num = Interleave.Unshuffle(x[2]); ulong num4 = num & 0xffffffffL; numArray[1] = num >> 0x20; Multiply(numArray, ROOT_Z, z); z[0] ^= num3; z[1] ^= num4; }
public static void Sqrt(ulong[] x, ulong[] z) { ulong[] array = Nat192.Create64(); ulong num = Interleave.Unshuffle(x[0]); ulong num2 = Interleave.Unshuffle(x[1]); ulong num3 = (num & 0xFFFFFFFFu) | (num2 << 32); array[0] = (num >> 32) | (num2 & 0xFFFFFFFF00000000uL); num = Interleave.Unshuffle(x[2]); ulong num4 = num & 0xFFFFFFFFu; array[1] = num >> 32; Multiply(array, ROOT_Z, z); ulong[] array2; (array2 = z)[0] = array2[0] ^ num3; (array2 = z)[1] = array2[1] ^ num4; }
public static void Invert(ulong[] x, ulong[] z) { if (Nat192.IsZero64(x)) { throw new InvalidOperationException(); } // Itoh-Tsujii inversion with bases { 2, 3 } ulong[] t0 = Nat192.Create64(); ulong[] t1 = Nat192.Create64(); Square(x, t0); // 3 | 162 SquareN(t0, 1, t1); Multiply(t0, t1, t0); SquareN(t1, 1, t1); Multiply(t0, t1, t0); // 3 | 54 SquareN(t0, 3, t1); Multiply(t0, t1, t0); SquareN(t1, 3, t1); Multiply(t0, t1, t0); // 3 | 18 SquareN(t0, 9, t1); Multiply(t0, t1, t0); SquareN(t1, 9, t1); Multiply(t0, t1, t0); // 3 | 6 SquareN(t0, 27, t1); Multiply(t0, t1, t0); SquareN(t1, 27, t1); Multiply(t0, t1, t0); // 2 | 2 SquareN(t0, 81, t1); Multiply(t0, t1, z); }
public override ECPoint Lookup(int index) { ulong[] x = Nat192.Create64(), y = Nat192.Create64(); int pos = 0; for (int i = 0; i < m_size; ++i) { ulong MASK = (ulong)(long)(((i ^ index) - 1) >> 31); for (int j = 0; j < SECT163R2_FE_LONGS; ++j) { x[j] ^= m_table[pos + j] & MASK; y[j] ^= m_table[pos + SECT163R2_FE_LONGS + j] & MASK; } pos += (SECT163R2_FE_LONGS * 2); } return(CreatePoint(x, y)); }
public virtual ECPoint Lookup(int index) { ulong[] x = Nat192.Create64(), y = Nat192.Create64(); int pos = 0; for (int i = 0; i < m_size; ++i) { ulong MASK = (ulong)(long)(((i ^ index) - 1) >> 31); for (int j = 0; j < SECT163R2_FE_LONGS; ++j) { x[j] ^= m_table[pos + j] & MASK; y[j] ^= m_table[pos + SECT163R2_FE_LONGS + j] & MASK; } pos += (SECT163R2_FE_LONGS * 2); } return(m_outer.CreateRawPoint(new SecT163FieldElement(x), new SecT163FieldElement(y), false)); }
public static void Sqrt(ulong[] x, ulong[] z) { ulong[] odd = Nat192.Create64(); ulong u0, u1; u0 = Interleave.Unshuffle(x[0]); u1 = Interleave.Unshuffle(x[1]); ulong e0 = (u0 & 0x00000000FFFFFFFFUL) | (u1 << 32); odd[0] = (u0 >> 32) | (u1 & 0xFFFFFFFF00000000UL); u0 = Interleave.Unshuffle(x[2]); ulong e1 = (u0 & 0x00000000FFFFFFFFUL); odd[1] = (u0 >> 32); Multiply(odd, ROOT_Z, z); z[0] ^= e0; z[1] ^= e1; }
public override ECFieldElement Multiply(ECFieldElement b) { ulong[] z = Nat192.Create64(); SecT131Field.Multiply(x, ((SecT131FieldElement)b).x, z); return(new SecT131FieldElement(z)); }
public override ECFieldElement AddOne() { ulong[] z = Nat192.Create64(); SecT131Field.AddOne(x, z); return(new SecT131FieldElement(z)); }
public SecT131FieldElement() { this.x = Nat192.Create64(); }
public override ECFieldElement Add(ECFieldElement b) { ulong[] z = Nat192.Create64(); SecT163Field.Add(x, ((SecT163FieldElement)b).x, z); return(new SecT163FieldElement(z)); }
public override ECFieldElement Square() { ulong[] z = Nat192.Create64(); SecT163Field.Square(x, z); return(new SecT163FieldElement(z)); }
public override ECFieldElement Invert() { ulong[] z = Nat192.Create64(); SecT163Field.Invert(this.x, z); return(new SecT163FieldElement(z)); }
public SecT163FieldElement() { x = Nat192.Create64(); }