Search code examples
passwordspassword-protectionpassword-hashlicense-keyproduct-key

Why do license/product keys contain hyphens/dashes?


All the license keys I've seen look like something like that: XXXX-XXXX-XXXX-XXXX

But why do they always contain dashes? Is there a specific advantage over keys like this: XXXXXXXXXXXXXXXX?

Follow-up question:

What's the best format for a license key? What I mean is:

how long ( in characters ) should it be?
How many possible characters? ( E.g. [ a-z, A-Z, 0-9 ] + two special characters, just [ a-z, A-Z ] or something else? )
Dashes? If so, every how many characters? ( XXXX-XXXX, XXXXX-XXXXX or something else? )


Solution

  • For the separation, because they often have to be manually entered and verified by a human. The initial reading - and then cross-checking the sequence to catch errors - is much easier as a series of chunks than as a single contiguous string.

    For the length, this often depends on a couple of factors - how globally unique you want it to be, how hard you want it to be to "brute force" (generate valid but unauthorized keys), and how easy you want it to be to enter. Most license keys have undisclosed checksum / signing mechanisms to reduce the efficiency of brute force (but can themselves also extend the length).