RSA , N, 512 . a e
(1)
, N, . , , , (1), a, e, N, , .
a . e
(2)
ti , . , e, :
, (3)
, e = 13, e = 11012, 13 , .
e.
(3), N, :
. a, , 1, .
... | ||||
... |
. .
. e=13 . :
e div 2 | ||||
e mod 2 |
1. e .
e , .
, , :
2. =5 e=13 19.
13. =5. :
,
:
Function Rise(A,B,N:Integer):Integer;
var
B2:array[1..20] of byte;
i,C,L:integer;
Begin
C:=B; i:= 1;
While C > 0 do
Begin
B2[i]:= C Mod 2;
C:= C div 2;
i:= i + 1;
End;
L:= i - 1;
i:= 1;
D:= A;
While i <L do
Begin
D:= (D * D) Mod N;
If B2[L-i]= 1 Then D:=(D * A) Mod N;
i:= i + 1;
End;
Rise:= D;
End;
RSA . , [1; N ] . , N, 1 , 1 106, 50 . T , . T , T+2 T+4 .. , . [A; B] Visual Basic :
|
|
Function Generator(A as Integer, B as integer) As Integer
Randomize
t = Rnd() * (B - A) + A
Generator = t
End Function
1. . , k, , . 2 . Visual Basic:
Function Check_prime(T As Integer) As Boolean
Dim k as integer
Dim k As Integer
Dim i As Integer
Dim b As Boolean
b = True
k = Int(Sqr(T))
For i = 2 To k
If T Mod i = 0 Then
b = False
Exit For
End If
Next i
Test_prime = b
End function
2. . , , . :
k a, T, , , , , a .
, , .. , a, T, . , , .
3. . . Җ1 N1=2s∙t, t . , a , :
) a,
) k, .
, , . :
1. a, 1 < a < , , ,
2. , k, , ,
- 1 2 , , , . .
k , , 4-k, .. .