I recently took some code from Delphi 2007 and upgraded it to Delphi 2009. This may or may not be relevant.
But when I run the code on my computer, decrypting the password does not decrypt correctly. Here is the code.
Seed := GenerateIntFromString('usercode'); // Check if a password already exists if TableUser.FieldByName('PASSWORD').AsString <> '' then begin EncodedPassword := TableUser.FieldByName('PASSWORD').AsString; DecodedPassword := EncryptDecrypt(EncodedPassword, Seed); //etc.. And the function function TLogonForm.EncryptDecrypt(Input: string; Seed: integer) : string; var i : integer; Output : string; begin RANDSEED := Seed; Output := ''; for i := 1 to Length(Input) do Output := Output + Chr(Ord(Input[i]) XOR (RANDOM(254) + 1)); Result := Output; end;
So, if my user code is TD and my password is "JOEJOE"
encrypted password: ì? Âp?
decrypted passowrd: JìEJùE
It should decrypt as JOEJOE, obviously. Kicker, if I create the code and send the exe to another user, it decrypts everything. This makes me believe that this is not something wrong with the code, but rather some kind of anomaly with my computer. What could it be?
You can refuse this because it is probably not related. I only mention this because it is a different case when something works fine on one computer, but not on another.
But there is one case when trying to set a filter
TableUser2.Filter := FilterString;
It works fine for me, but another user gets an error.
TableUser2: Error 3106: An unsupported statement was found in a write filter expression.
Even when we filter the same name with the same code. Perhaps a database problem?