Menu

#5 Verify registration against code (Solution inside)

1.15
closed
None
5
2015-12-22
2007-04-21
No

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;

Discussion

  • Andrew Haines

    Andrew Haines - 2015-12-11
    • status: open --> closed
    • assigned_to: Andrew Haines
    • Group: --> Later
     
  • Andrew Haines

    Andrew Haines - 2015-12-22
    • Group: Later --> 1.15
     

Log in to post a comment.

MongoDB Logo MongoDB