More of a math question, but it relates back to a DB

Discussion in 'Databases' started by grutland, Jan 31, 2011.

  1. #1
    Hi,

    I have a client who is asking for some generated product keys.
    This is not an issue and have created 25,000 unique keys for him so far.

    Now though, he is asking for more and I'm not sure how many more I can uniquely create.
    My keys are in the format of:
    XXXX-XXXX-XXXX-XXXX-XXXX
    Code (markup):
    With each 4 character section containing A-Z0-9 (only uppercase).
    Is there an equation I can do to work out how many codes I can create with out having to keep inserting into a DB table until it starts throwing errors?
     
    grutland, Jan 31, 2011 IP
  2. grutland

    grutland Active Member

    Messages:
    86
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #2
    Not to worry, some one at work knew the equation.
    Thanks any way.
     
    grutland, Jan 31, 2011 IP
  3. NickW2

    NickW2 Greenhorn

    Messages:
    61
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    20
    #3
    There's 13367494538843734067838845976576 possible combinations :).
     
    NickW2, Jan 31, 2011 IP
  4. plog

    plog Peon

    Messages:
    298
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    0
    #4
    NickW2 is theoretically right, but from a practical standpoint, you're going to want to avoid ones like:

    YOUR-MOMS-ABIG-DUMB-SLUT

    Or maybe not.
     
    plog, Jan 31, 2011 IP
  5. idzire

    idzire Peon

    Messages:
    80
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    LOL

    no need to avoid them, let his client ROFLHAO
     
    idzire, Feb 1, 2011 IP
  6. srisen2

    srisen2 Peon

    Messages:
    359
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    that would be something if i saw that as a product key
     
    srisen2, Feb 4, 2011 IP
  7. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #7
    Putting the "YOUR-MOMS-ABIG-DUMB-SLUT" key aside, the problem with what you're suggesting, is that you would need to create keys incrementally or with some logic if you don't want to check to see if the key exists. This isn't a good way of doing it unless you can develop a very complex and non-reversible key generator. The last thing you want is keys that can be guessed. Key collisions and incremented keys cause a lot of problems for licensing when someone figures out how to create a valid key for a product.
     
    jestep, Feb 7, 2011 IP
  8. NickW2

    NickW2 Greenhorn

    Messages:
    61
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    20
    #8
    With that many possible combinations, the chance of randomly generating the same key twice even if you're doing millions of keys is infinitesimal. You'd have more chance of winning the lottery several times in a row then producing the same key twice.

    Completely random keys is the best way of doing it. I wouldn't bother checking for duplicates until you're in the range of generating trillions of keys (literally).

    There's more possible keys there than the number of grains of sand on Earth multiplied by 100 billion.
     
    Last edited: Feb 7, 2011
    NickW2, Feb 7, 2011 IP
  9. srisen2

    srisen2 Peon

    Messages:
    359
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #9
    But if you don't check a database for duplicate keys and actually run fraud checks on your licenses then you run the chance of having flawed system. And if you system is flawed then the keys are only a scare tactic for consumers. Processing a check on a code takes only a few lines of code and would not be a bother at all for anyone that knows programming to implement I would suggest checking and having a database if you wish to go to the trouble of having a key at all.
     
    srisen2, Feb 7, 2011 IP
  10. NickW2

    NickW2 Greenhorn

    Messages:
    61
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    20
    #10
    No, I agree, checking the keys in a database wouldn't be an issue at all given the (relatively small) number of keys you're likely to be generating. There is literally no point though.

    And I'm of course talking purely about the generation of keys, not checking the keys are authorised and only being used once etc. There'd be no point generating product keys if you weren't putting them in a database to verify the legitimacy of a customer's key.
     
    Last edited: Feb 7, 2011
    NickW2, Feb 7, 2011 IP
  11. nirajkum

    nirajkum Active Member

    Messages:
    815
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #11
    nice plog ... :) may be the company would fire you for this kind of key ..
     
    nirajkum, Feb 7, 2011 IP
  12. Thales

    Thales Peon

    Messages:
    144
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Ergo,
    YOUR-MUMS-ABIG-DUMB-SLUT
     
    Thales, Feb 19, 2011 IP
  13. rdthewall

    rdthewall Active Member

    Messages:
    1,225
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    80
    #13
    A-Z = 26 character
    0-9 = 10 characters

    Key lenght = 20 characters

    You can uniquely create 36^20 keys which is good enough to serve your client till his death:D


    Not sure what you meant by that.
     
    rdthewall, Apr 25, 2011 IP