title: Designing a Good Hash Function for Set Length URL Shortening in PHP
body: <p>I'm working on a URL shortener. The input is a URL and the output needs to be a 4 character string (alphanumeric, case-sensitive).</p>
  
  <p>I calculated it out that if I use 4 characters with a case-sensitive alphanumeric key space I should potentially be able to store 64^4 (16777216) URLs until I run out of space.</p>
  
  <p>I also don't want my URL shortener to generate any short URLs that are offensive four letter words. It would be unfortunate if someone made a short URL that was domain.com/f**k. You get the picture...</p>
  
  <p>Any ideas on the best way to go about this? I feel like I'll be using base64_encode somewhere in the process.</p>