{** Encripta una cadena **}
Function EncryptStr(Str, Pwd :String) :String;
    Var
        Result :String;
        Ascii    :Integer;
    Begin
        Result := '';
        For Index := 1 to Length(Str) do
            Begin
                Ind := (Index Mod Length(Pwd));
                If (Ind=0) then Ind := Length(Pwd);
                Ascii :=  Ord(Str[Index]) + Ord(Pwd[Ind]);
                If (Ascii>255) then Ascii := Ascii - 256;
                Result := Result + Chr(Ascii);
            End; {For}
        EncryptStr := Result;
    End; {EncryptStr}
 
 
{** Desencripta una cadena **}
Function UnEncryptStr(Str, Pwd :String) :String;
    Var
        Result :String;
        Ascii    :Integer;
    Begin
        Result := '';
        For Index := 1 to Length(Str) do
            Begin
                Ind := (Index Mod Length(Pwd));
                If (Ind=0) then Ind := Length(Pwd);
                Ascii :=  Ord(Str[Index]) - Ord(Pwd[Ind]);
                If (Ascii<0) then Ascii := Ascii + 256;
                Result := Result + Chr(Ascii);
            End; {For}
        UnEncryptStr := Result;
    End; {UnEncryptStr}