How can I filter profanity in base36 identifiers?

I want to use base36 in a web application that I am developing ... but since the identifier is displayed to users as a URL, I want to filter profanity. Has anyone solved this? Or is this even a real problem?

Does it make sense to just skip the numbers in my sequence in the database?

+5
source share
2 answers

Well, instead of trying to accumulate all possible curses, just filter out the vowels. This will leave you many permutations in space. Admittedly, you just reduced from base 36 to base 31, but the numbers in base 31 are real numbers in base 36, assuming the same character set (a-z0-9). If this bothers you, replace the five vowels with other non-magic 7-bit ascii !, @, $,% AND (.

Of course, you can end up with sh1t and fck, but profanity is in the reader's mind.

+9
source

Why not just use the full-size random GUID in hexadecimal format? No matter what programming language you work in, this should be easily generated. And, being presented in hexadecimal form, I imagine the probability of generating something that violates the easily offended approach to zero.

+2
source

Source: https://habr.com/ru/post/1340204/


All Articles