How to assign users unique and meaningful identifiers to child users while avoiding various pitfalls?
In my application, we need to assign unique identifiers to users, but this is turning out to be trickier than I would have thought.
We load all users from a bulk feed, and do all the assigning programmatically. Users can't pick their own.
We also want all user names to be the same length, for certain display purposes.
Also, the users are students in a school district, and they are children, some of them quite young, so the names have to be short and reasonably memorable. So just generating a 7 digit code isn't very user friendly.
We know the name of each child, but there are laws about identifying children. We wouldn't want, for instance, someone to be able to post a screenshot of their username online and have someone be able to identify their real name.
My first idea for this was to choose, say, the first 3 characters of the first name, the first 2 characters of the last name, and then append a sequence number to avoid collisions. So mine would be something like josfr123
.
This failed, though, because some kids have names with fewer than 3 letters. But the more damning problem was that a small number of these combinations produced swear words, and that is so bad in software for children that we can't allow it to happen even once.
It turns out to be surprisingly hard to prevent this, because there are so many combinations of letters that don't spell anything, but if you tried to read them out loud, you'd get something obscene. Catching all of these, reliably, seems impossible, and even if I could, I'd still need to find some way to generate a name for that user.
So what to do?