title: Javascript generate unique number based on string
body: <p>Lets say I have a string <code>var input = "Foo"</code> and I need a 100% unique number from that string, I tried something like</p>
  
  <pre><code>for (var i = 0, len = input.length; i &lt; len; i++) {
        output += input[i].charCodeAt(0)
  }
  </code></pre>
  
  <p>But this generates duplicates like <code>W8M</code> and <code>YSM</code> and both return the id of <code>149</code>. </p>
  
  <p>Is there an algorithm for something like this?</p>