如题!
只要行,马上给分!

解决方案 »

  1.   

    md5方法不错,如果是保存口令等可以单向加密的推荐此法,不然,可以自已写些加密方法, hubdog的那篇不错的资料里就有一个example,但记不起名了。
      

  2.   

    1.先將此文本文件的後綴改變為未見過的類型,使用戶不從文本角度考慮。
    2.再對此文本文件的每個字符加密。如(ord(字符)+3)*2
    3.需要讀取時再反向操作
      

  3.   

    to: apollp(不一定正確) 
    读取时怎么反向操作?
      

  4.   

    to:  foreveryday007(有無數種方法可以浪費一天的時間…但是…) 
    一堆方法在那儿呢,能否告知?
      

  5.   

    反向操作?
    如果正向操作是:(ord(字符)+3)*2
    那反向操作就是:(ord(字符)/2)-3
      

  6.   

    //加密一个字符串
    function XorEncode(const Key, Source: string): String;
    var
      I: Integer;
      C: Byte;
    begin
      Result := '';
      for I := 1 to Length(Source) do begin
        //和关键字产生一个随机数
        if Length(Key) > 0 then
          C := Byte(Key[1 + ((I - 1) mod Length(Key))]) xor Byte(Source[I])
        else
          C := Byte(Source[I]);
        //产生一个二位的十六进制代码
        Result := Result + AnsiLowerCase(IntToHex(C, 2));
      end;
    end;//解密一个字符串
    function XorDecode(const Key, Source: string): String;
    var
      I: Integer;
      C: Char;
    begin
      Result := '';
      for I := 0 to Length(Source) div 2 - 1 do begin
        C := Chr(StrToIntDef('$' + Copy(Source, (I * 2) + 1, 2), Ord(' ')));
        if Length(Key) > 0 then
          C := Chr(Byte(Key[1 + (I mod Length(Key))]) xor Byte(C));
        Result := Result + C;
      end;
    end;
      

  7.   

    示例如下:
    XorEncode(EncodeKey, PasswordEdit.Text)
    XorEncode(EncodeKey, PasswordEdit.Text)
      

  8.   

    还有一条
    const  EncodeKey = '20030504';
      

  9.   

    ezlz(猫嘴里的猪) 的方法如果数据记录很多,效率很底的,自己定一文本文件的结构体,按定的无无类型文本文件读写,可以满足你的要求,读写方便,
      

  10.   

    比如
        type g_power = packed record
        ys : Smallint;
        gl : integer;
      end;//读
    rocedure TForm2.Memo1Click(Sender: TObject);
    var  FileN:string;
         TextFileVar: file;
         i,K,M,N:integer;
         j:SmallInt;
         c_power: array[0..15] of g_power; //文件数据结构
         WgYear,WgMonth,WgDay:word;  //要导入的日期
    begin
       if  Memo1.Items.Count>0 then
       begin
          try
          AssignFile(TextFileVar ,Memo1.Items.Strings[Memo1.ItemIndex]);
          Reset(TextFileVar, 1);
          M:=1;
          While not Eof(TextFileVar) Do
          Begin
            BlockRead(TextFileVar, j, SizeOf(j), i);
            BlockRead(TextFileVar, c_power, SizeOf(g_power)*16, i);
            For k:=1 to 16 do
            begin
              StringGrid1.Cells[K,M]:=inttostr(c_power[k-1].GL);
            end;
              M:=M+1;
            end;
        finally
          CloseFile(TextFileVar);
        end;
       end;
    end;//如果是写也一样的