Link to home
Start Free TrialLog in
Avatar of wagnerlimalopes
wagnerlimalopesFlag for Brazil

asked on

Crypto Letters and Numbers

hello
I would like to know how to change the encryption algorithm below for it to return only letters and numbers?

function EncryptDecrypt(InpStr, PassPhrase: string; Salt: Integer): string;
var
  iIndex: Integer;
  pIndex: Integer;
begin
  pIndex := 1;

  for iIndex := 1 to Length(InpStr) do
  begin
      InpStr[iIndex] := Chr(Salt XOR Ord(PassPhrase[pIndex]) XOR Ord(InpStr[iIndex]));
      Inc(Salt);
      Inc(pIndex);

      if (pIndex > Length(PassPhrase)) then
         pIndex := 1;
  end;

  Result := InpStr;
end;

Open in new window



thanks
Wagner
Avatar of Thommy
Thommy
Flag of Germany image

If you change encryption, you will have to change decryption, too!!!
Avatar of wagnerlimalopes

ASKER

even having to separate the encryption and decryption codes, what is the solution?

wagner
SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial