3 ms·
Random Strings and Integers That Aren’t
- Sharlin 6y agoShould be common knowledge, but please avoid using 1, I, l, O, and 0 in codes such as these.
- brainbag 6y agoIf you really want to avoid any potential similarities, your character option of A-Z and 0-9 is even more limited to "abdfhjkprstuvwxyzACGHJKLMNPQRVWXY3469", according to this research: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3541865/ https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3541865/
- csunbird 6y agoThe alphabets that are created for nanoid seems to be a valid choice too: https://github.com/CyberAP/nanoid-dictionary https://github.com/CyberAP/nanoid-dictionary
- richrichardsson 6y agoIt's not strictly necessary to remove all the similar characters, as you can treat any of the similar inputs as being the same. eg. you could include 8 or B in the output, as long as you accepted 8 and B as being the same character you chose for output at input. If you want to avoid the possibility of accidental profanity in your "random" strings, it is definitely worthwhile removing the vowels, although that may not apply to other languages than English!
- yencabulator 6y agohttps://philzimmermann.com/docs/human-oriented-base-32-encoding.txt https://philzimmermann.com/docs/human-oriented-base-32-encod...
- dhsysusbsjsi 6y agoI disagree about excluding all of these in some situations. For example if you know you use CAPS, then L is fine and not ambiguous. 1 is also fine.
- erichurkman 6y agoUntil someone in design or marketing changes the font on you.
- Sharlin 6y agoWhich is why I only mentioned lowercase l. 1 in some (especially serif) fonts looks like l and in some others (especially sans serif) like I. Definitely not okay in general.
- scott31 6y agoShould be common knowledge, but please start using decent fonts that can distinguish different characters
- SloopJon 6y agoThis post is in the context of a PostgreSQL stored procedure. If you have ready access to a block cipher, you could use one with an appropriate block size; e.g., 32-bit RC5 for coupon codes, 128-bit AES for activation keys, or 64-bit Blowfish for something in between.