Шифрование методом Льюиса, Шифрование методом Атбаш, Шифрование методом Цезаря, Квадрат Полибия, Шифр Вижинера, Шифр Гронсфельда, Шифрование с помощью решетки, Шифр Хилла (с длиной блока = 2),
function CaesarEncipher(toCode: string): string; var i, T: integer; begin for i := 1 to length(toCode) do begin T := (Ord(toCode[ i ]) + n); if T >= 256 then dec(T, 256); toCode[ i ] := Chr(T); end; CaesarEncipher := toCode; end;
function CaesarDecipher(toDecode: string): string; var i, T: integer; begin for i := 1 to length(toDecode) do begin T := (Ord(toDecode[ i ]) - n); if T < 0 then Inc(T, 256); toDecode[ i ] := Chr(T); end; CaesarDecipher := toDecode; end;
{ применение: } var s: string;
begin s := CaesarEncipher('just a Caesar'); writeln(s); writeln('s = ', CaesarDecipher(s)); end.