}
Додаток 4
RSA
1. public intEuklid (int a, int b)
2. {
3. int d0, d1, d2, x0, x1, x2, y0, y1, y2, q;
4. d0 = a;
. d1 = b;
. x0 = 1;
. x1 = 0;
. y0 = 0;
. y1 = 1;
. while (d1> 1)
. {
. q = d0/d1;
. d2 = d0% d1;
. x2 = x0 - q * x1;
. y2 = y0 - q * y1;
. d0 = d1;
. d1 = d2;
. x0 = x1;
. x1 = x2;
. y0 = y1;
. y1 = y2;
. }
. return y1;
. }
.
26. private intEiler (int r)
27. {
. int i, div1 = 0, pq;
29. for (i = 2; i <= Convert.ToInt32 (Math.Sqrt (r)); i + +)
30. {
. if (r% i == 0)
. div1 = i;
. }
. pq = (div1 - 1) * (r/div1 - 1);
. returnpq;
. }
.
38. public int K0 (intp, intq, intKc)
39. {
. intKo = 0;
. intfi;
.
. r = p * q;