function PolibiusEncipher(toCode: string): string; var i: integer; ix, jx: char; s: string; begin s := ''; for i := 1 to length(toCode) do begin
for ix := '_' to 'Ё' do for jx := '_' to 'Ё' do if TPolibius[ix, jx] = toCode[ i ] then begin s := s + ix + jx; break; end;
end; PolibiusEncipher := s end;
function PolibiusDecipher(toDecode: string): string; var i: integer; s: string; begin s := ''; i := 1; while i <= length(toDecode) do begin s := s + TPolibius[toDecode[ i ], toDecode[succ(i)]]; inc(i, 2); end; PolibiusDecipher := s end;
procedure TForm1.Button1Click(Sender: TObject); begin s := PolibiusEncipher('POLIBIUS'); // writeln(s); Memo1.lines.add(s); Memo1.lines.add('s = '+ PolibiusDecipher(s)); end;