Beispiel #1
0
        /* this*=sqrt(-1) */
        public void Times_i()
        {
            FP z = new FP(a);

            a.Copy(b);
            a.Neg();
            b.Copy(z);
        }
Beispiel #2
0
        /* this-=b */
        public void Sub(FP b)
        {
            FP n = new FP(b);

            n.Neg();
            this.Add(n);
        }
Beispiel #3
0
        public void RSub(FP b)
        {
            FP n = new FP(this);

            n.Neg();
            this.Copy(b);
            this.Add(n);
        }
Beispiel #4
0
        /* negate this mod Modulus */
        public void Neg()
        {
            FP m = new FP(a);
            FP t = new FP(0);

            m.Add(b);
            m.Neg();
            t.Copy(m);
            t.Add(b);
            b.Copy(m);
            b.Add(a);
            a.Copy(t);
        }
Beispiel #5
0
        /* this=1/this */
        public void Inverse()
        {
            Norm();
            FP w1 = new FP(a);
            FP w2 = new FP(b);

            w1.Sqr();
            w2.Sqr();
            w1.Add(w2);
            w1.Inverse();
            a.Mul(w1);
            w1.Neg();
            w1.Norm();
            b.Mul(w1);
        }
Beispiel #6
0
        /* this*=this */
        public void Sqr()
        {
            FP w1 = new FP(a);
            FP w3 = new FP(a);
            FP mb = new FP(b);

            w1.Add(b);
            mb.Neg();

            w3.Add(a);
            w3.Norm();
            b.Mul(w3);

            a.Add(mb);

            w1.Norm();
            a.Norm();

            a.Mul(w1);
        }
Beispiel #7
0
 /* set to a-ib */
 public void Conj()
 {
     b.Neg();
     b.Norm();
 }