[ACCEPTED]-Is it irrational to sanitize random character strings for curse words?-filter
Don't generate random strings with vowels 2 and then you don't have to worry about curse 1 words.
Yes, on the grounds that anyone who would 4 be offended by something they saw in a randomly 3 generated string can think of more things 2 they find offensive than you can sanitize.
Don't 1 optimize for the insane.
Microsoft omits the following from their 20 product keys:
0 1 2 5 A E I O U L N S Z
I omit those from [0-9A-Z], and 19 once the key is generated, I match against 18 a list I found of two-letter combinations most common 17 in English, and regenerate the key if there 16 is a match. For speed, I edit the list of 15 letter pairs by first culling from that 14 list the pairs that are already prevented 13 due to their inclusion of a character in 12 the stripped list ('HE' can't exist if the 11 key is generated from a character set that 10 does not include 'E'), then convert some 9 from 'E' to '3', as in 'H3' instead of 'HE', etc. I 8 have also added a few of my own, like 'KK' and 7 'CK' for edge cases. One could also omit 6 '3' for speed as necessary, although the 5 more characters you omit the fewer unique 4 keys can be generated.
Probably not a perfect 3 solution, but it's fast enough for my needs 2 and prevents almost all English words from 1 being generated, offensive or not.
Simplest solution is to generate from a 8 'sanitized' alphabet; use a set of characters 7 that cannot possibly form words. One suggestion 6 in one of the answers is hexadecimal which 5 is an excellent choice, or otherwise drop 4 some critical letters from the alphabet.
Note 3 that just dropping vowels is not going to 2 do the job... it is all too easy to infer 1 them from the remaining consonants.
That makes sense to me. I mean, it would 6 be a pretty bad PR disaster if someone posts 5 a picture of your product, with this stamped 4 on the back of the CD case:
12345-67890-F**KU-ABCDE-FGHIJ
It 3 sounds funny but you never know what kind 2 of sense of humor the person will have who 1 happens to pick up that package.
I think it's better to plainly avoid vowels. A 3 product key like JKL-YOUAREMYFRIEND-0001-KK 2 may not be offensive but it doesn't sound 1 like serious business either.
Limit your randomly generated "words" to 8 hex characters and I don't believe you'll 7 have any English-language curses. This also 6 pushes you down a path of not spending too 5 much time on your random word generator.
Of 4 course, there may be some language where 3 you can curse with hex digits, but then 2 you're not likely to know/filter those curses 1 anyway.
If you are just worried about product keys, I 8 would stick to hexadecimal digits, maybe 7 even a guid would work for you. Probably 6 no chance of a "naughty" word being generated 5 with these constraints. You could also just 4 stick to numbers as well. If you must have 3 random strings with all letters of the alphabet, it 2 is probably better safe than sorry so I 1 would do the filtering.
We are using a random string generator for 8 a security key that will be sent to customers, and 7 did not omit vowels from the allowable characters, etc. No 6 word of a lie, one of the strings it generated 5 was "7D9WAF*CKS" ...! Luckily, this was 4 discovered during development, and we are 3 now going to restrict the allowable characters. Whew!! That 2 was a close one - happy to have found this 1 posting !
It's certain conceivable, but I wouldn't 2 devote much time to it, especially if you've 1 got letters and numbers.
I'm using randomly generated, phonetic-sounding 5 passwords for one webapp I wrote. I did 4 end up hard-coding a list of "dirty" words 3 that aren't acceptable, but the list that 2 matched my pattern ended up being pretty 1 short.
No. You have no chance to collect all curse 2 words in all world languages. Those words 1 usually don't appear in dictionaries.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.