кто может объяснить эти процедуры что в них происходит???
/Функция быcтрого возведения в степень
Код:
function FastPower(a, b, n: integer): integer;
var i: integer;
ai: extended;
begin
ai := a;
for I := Trunc(log2(b)) - 1 downto 0 do
if Bit(b, i) then ai := Round(sqr(ai) * a) mod n else ai := Round(sqr(ai)) mod n;
result := Round(ai);
end;
function Encrypt(s: string; e, n: integer): TIncodeMes;
var I: Integer;
begin
SetLength(result, length(s));
for I := 0 to Length(s) - 1 do
result[i] := FastPower(ord(s[i + 1]), e, n)
end;
function Decrypt(s: array of integer; e, n: integer): string;
var i: Integer;
begin
SetLength(Result, Length(s));
for I := 0 to Length(s) - 1 do
result[i + 1] := chr(FastPower(s[i], e, n))
end;
Admin: Пользуемся тегами!