- program asci_crypto;
-
- {$APPTYPE CONSOLE}
-
- uses
- SysUtils;
-
- var
- tocrypt, crypted, crypted_short, checksum : string;
- i : integer;
-
- begin
- { TODO -oUser -cConsole Main : placez le code ici }
-
- WriteLn('Programme de cryptographie... Dr_T');
- Readln(tocrypt);
-
- if not ((Length(tocrypt) mod 2))=0 then tocrypt:=tocrypt+' ';
-
- for i:=1 to Length(tocrypt) do
- begin
- if not (i mod 2 = 0) then crypted:=crypted+(IntToStr( (ord(tocrypt[i])+ord(tocrypt[i+1]))));
- if (i mod 3 = 0) then crypted_short:=crypted_short+(IntToStr( (ord(tocrypt[i])+ord(tocrypt[i+1]))));
- Write('caractere a encoder:');
- WriteLn(IntToStr(ord(tocrypt[i])));
- Write('->');
- Writeln(IntToStr(ord(tocrypt[i])+ord(tocrypt[i+1])));
- end;
-
- for i:=1 to Length(tocrypt) do
- begin
- if (ord(tocrypt[i]) mod 7 = 0) then checksum:=checksum+crypted[i];
- end;
-
- WriteLn('La chaine cryptee est:');
- Writeln(crypted);
- WriteLn;
- WriteLn('La chaine cryptee courte associee est:');
- WriteLn(crypted_short);
- WriteLn;
- WriteLn;
- WriteLn('Attention, le checksum n''est revelateur que pour de grandes chaines!');
- WriteLn('Checksum:');
- WriteLn(checksum);
- readln(tocrypt);
-
- end.
program asci_crypto;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
tocrypt, crypted, crypted_short, checksum : string;
i : integer;
begin
{ TODO -oUser -cConsole Main : placez le code ici }
WriteLn('Programme de cryptographie... Dr_T');
Readln(tocrypt);
if not ((Length(tocrypt) mod 2))=0 then tocrypt:=tocrypt+' ';
for i:=1 to Length(tocrypt) do
begin
if not (i mod 2 = 0) then crypted:=crypted+(IntToStr( (ord(tocrypt[i])+ord(tocrypt[i+1]))));
if (i mod 3 = 0) then crypted_short:=crypted_short+(IntToStr( (ord(tocrypt[i])+ord(tocrypt[i+1]))));
Write('caractere a encoder:');
WriteLn(IntToStr(ord(tocrypt[i])));
Write('->');
Writeln(IntToStr(ord(tocrypt[i])+ord(tocrypt[i+1])));
end;
for i:=1 to Length(tocrypt) do
begin
if (ord(tocrypt[i]) mod 7 = 0) then checksum:=checksum+crypted[i];
end;
WriteLn('La chaine cryptee est:');
Writeln(crypted);
WriteLn;
WriteLn('La chaine cryptee courte associee est:');
WriteLn(crypted_short);
WriteLn;
WriteLn;
WriteLn('Attention, le checksum n''est revelateur que pour de grandes chaines!');
WriteLn('Checksum:');
WriteLn(checksum);
readln(tocrypt);
end.