3

I need the shortest possible Ids so I figure base-36 would work wonderful for this. The thought is I'll just use an auto-incrementing Id field as the primary key and then create a base-36 userid. Unfortunately I'll inevitably run into a lot of vulgar word combinations. I'm having a hard time wrapping my head around the best approach to solve this because the suspect word could be in any combination of strings.

Any thoughts?

Thanks

Chance
  • 11,043
  • 8
  • 61
  • 84
  • Hmm, I wonder if I make it base 35 and use 0 as a replace field for vulgar words. Sort of like a0s, fu0k, 0ick.. hmm – Chance Jul 19 '09 at 03:55
  • 3
    don't skip them. It makes a programming career worthwhile!!! – Mitch Wheat Jul 19 '09 at 03:56
  • 1
    @Mitch - lol, this is true. I'd feel bad to watch a non-profit get sued cause some 15 year old chick got the user id cun..... – Chance Jul 19 '09 at 03:58

1 Answers1

7

You could omit vowels from your selection of digits (either using base 31 or adding some more characters to bring it back up to 32 or 36 or whatever).

If your system can handle being case sensitive, then you can use both upper and lower case letters to extend your range of digits. You indicated that length is important, so this might be a useful approach.

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
  • Yea, I like that a lot better than using a wildcard replace. Thanks! – Chance Jul 19 '09 at 03:59
  • 1
    upper/lower without vowels is 62, chuck in another two and you've got your own profanity free implementation of base64... not nearly as much fun, but I suppose you're right in that it might save some explanations down the track... – Matthew Scharley Jul 19 '09 at 04:15