我这儿有控件Base64,根据RFC2045定义规范加密.
// uTBase64 v1.0 - Simple Base64 encoding/decoding class
// Base64 described in RFC2045, Page 24, (w) 1996 Freed & Borenstein
// Delphi implementation (w) 1999 Dennis D. Spreen (dennis@spreendigital.de)
// This unit is freeware. Just drop me a line if this unit is useful for you.
email:ghsoft@yeah.net
不过,如果真要提高还是建议你去看一些加密算法方面的书籍,这个只能救急,治标不治本。
异或最好了:for i:=1 to length(s) do
s[i]:=chr(ord(s[i])xor 255);
F:TextFile;
S:string;
Assignfile(F1,'file1.txt');
Rewrite(F1);
for i:=0 to memo1.Lines.Count-1 do
begin
s:=memo1.lines.Strings[i];
for j:=1 to length(s) do
s[j]:=chr(ord(s[j])xor 255);//写时加密
writeln(F1,s);
end;
CloseFile(F1);
Assignfile(F1,'file1.txt');
Reset(F1);
while not Eof(F1) do
begin
Readln(F1,s);
for i:=1 to length(s) do
s[i]:=chr(ord(s[i])xor 255);//读时解密;
memo1.lines.Add(s);
end;
CloseFile(F1);