I want to generate a 6 digits serial number, ranged from A-Z (only uppercase allow), e.g.
serial = "ABCDEF"
the problem is, some letters are considered confusing to others letters/numbers, e.g.
U <-> V
O <-> 0 (number)
I <-> 1 (number)
So, are there any existing set of safe letters can be used as seed to generate a safe serial number?
Depending on the font you use:
- B (not visually very different from the digit 8)
- C (with some fonts, the difference with O may be barely noticeable),
- D (for the same reason as C),
- I (is it the digit 1?),
- O (is it the digit 0?),
- Q (with some fonts, the difference with O may be barely noticeable),
Note that you shouldn’t exclude just one character (say O in 0/O) in a pair, but both (O and 0). Users won’t know you excluded them, unless you make it obvious by triggering some visual response when such character is entered in the text-box. As an illustration, a few years ago, I’ve written a custom CAPTCHA where, indeed, characters like “B” were excluded. Below the CAPTCHA, there was a piece of text:
The image doesn’t contain the following characters: B, D, I and O.
According to the logs, there were still many users who tried those four characters. Modifying the CAPTCHA to:
The image doesn’t contain the following characters B, D, I, O, 0, 1 and 8.
helped, since there was no longer any ambiguity. Later, removing the piece of text haven’t decreased the success ratio.
Instead of excluding letters, you may also try those alternatives:
-
Chose a good font which is particularly clear. For example, Slashed zero page on Wikipedia discusses the particular aspect of “0/O”. Another example is that when written like this:
0/O
, it becomes obvious which one is the digit and which one is the capital letter. -
If the serial is not printed on the software package, but rather available in digital form, make it easy to copy-paste. For example, many products which have 25-characters serials separated in 5 groups by dashes use 5 text-boxes, but let you to copy-paste the entire serial number, handling dashes automatically.
-
Use digits only. In this case, either start all serial numbers by a digit from 1 to 9, or handle the case where the user doesn’t enter the leading zeroes: when having to enter the serial such as
003197
, some users will enter it as-is, while others will enter only the last four digits.
Also, put spaces or dashes in your serials. Compare the ones on the left with the ones on the right:
5F91PS 5F-91-PS
CY4BIW CY-4B-IW
ZHL0A2 ZH-L0-A2
The ones on the right are easier to type and to spell on a phone (this is also the reason why Microsoft’s serials contain dashes, although their length (25 characters) makes them very difficult to type anyway).
1