As has been pointed out already, these schemes are essentially security by obscurity--i.e. not so good. In practice, the keep honest people honest, but can be circumvented by anyone who cares to spend the time and effort.

The usual approach is to take some unique information (serial number, licensee name and address, etc.), combine it with secret salt value(s) and hash and chop and mash and mix and boil and burn. When you finish you want to wind up with a nice registration code. You need to make up your own ledgerdemain. A good system will provide numbers that are hard to combine to recover the salt value. The secret salt must be stored in the file, so you'll probably want to hide it in your code somehow--do something like use the 8 bit xor sum of line 256 in your perl script rather than my $salt = 'SECRETSALT-WOOT'; .

Textfiles.org has some essays on cracking serial numbers, they may give you some ideas about how other systems work.

If you read the above sources, you'll see that even if you generate ultra-secure codes that cannot be guessed, someone can always decompile your software and reverse engineer your algorithms. If you want maximum achievable security, you'll have to write code that comes out obscured after it has been deparsed, or decompiled (or write obscured assembler). Of course this code can still be decontstructed by a dedicated cracker.


TGI says moo


In reply to Re: Serial Generation and Validation by TGI
in thread Serial Generation and Validation by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.