Mega Code Archive

 
Categories / Delphi / Strings
 

Encrypt a password

Title: encrypt a password? procedure TForm1.Button1Click(Sender: TObject); var s: String[255]; c: array[0..255] of Byte absolute s; i: Integer; begin {encode} s := 'SwissDelphiCenter.ch'; for i := 1 to Ord(s[0]) do c[i] := 23 xor c[i]; Label1.Caption := s; {Decode} s := Label1.Caption; for i := 1 to Length(s) do s[i] := Char(23 xor Ord(c[i])); Label2.Caption := s; end;