program z;
uses crt;
var
k,j,i,e,d,p,q,phi,n,l:integer;
m,c:string;
arr:array[0..100] of byte;
begin
clrscr;
write('p=');
readln(p);
write('q=');
readln(q);
writeln('enter you message');
readln(m);
n:=p*q;
writeln(n);
phi:=(p-1)*(q-1);
writeln(phi);
for i:=2 to phi-1 do
begin
if not (phi mod i=0) then e:=i;
for j:=2 to phi-1 do
begin
if e*j mod phi=1 then d:=j;
end;
end;
writeln(e);
writeln(d);
for k:=0 to length(m)-1 do
begin
l:=ord(copy(m,k,1));
c:=exp(ln(l)*e) mod n;
end;
writeln©;
readln;
end.
Сообщение отредактировано: APAL -