- status: open --> closed
- assigned_to: Andrew Haines
- Group: --> Later
I want to make sure that the user enters the correct company name where the code is registered to.
The code is generated in an external app by entering a company name and a expiration date.
In the main app, the user has to enter the company name (owner of the registration) and the related key.
Here my solution (you can copy& paste it into OnGuard.pas):
function IsRegCodeRegisteredTo(const Key : TKey; const Code : TCode; const RegStr : string) : Boolean;
var
Work : TCode;
S : string;
I,
RegString: Integer;
begin
Work := Code;
MixBlock(T128bit(Key), Work, False);
{strip accented characters from the registration string}
S := RegStr;
for I := Length(S) downto 1 do
if Ord(S[I]) > 127 then
Delete(S, I, 1);
RegString:= StringHashElf(AnsiUpperCase(S));
Result := Work.RegString = RegString;
end;