title: Idempotent hash associations
body: <p>I have some names: <code>["James", "John", "Krieg"]</code> and some colors: <code>["Red", "Green", "Blue", "Yellow"]</code>. I want to map names to colors, using some hashing function: <code>f(name) -&gt; color</code>. This association is idempotent. For example, if in the original list, <code>f(James) -&gt; Red</code>, then after I add names or colors to their respective lists, <code>f(James)</code> remains <code>Red</code>. </p>
  
  <p>Example:</p>
  
  <p>List state 1:</p>
  
  <pre><code>["James", "John", "Krieg"] and ["Red", "Green", "Blue", "Yellow"]: 
      f(James) -&gt; Red
      f(John) -&gt; Yellow 
      f(Krieg) -&gt; Yellow
  </code></pre>
  
  <p>List state 2:</p>
  
  <pre><code>["James", "John", "Krieg", "Sarah"] and ["Red", "Green", "Blue", "Yellow", "Black"]: 
  (added "Sarah" and "Black")
      f(James) -&gt; Red
      f(John) -&gt; Yellow 
      f(Krieg) -&gt; Yellow
      f(Sarah) -&gt; Green
  </code></pre>
  
  <p>The specifics of the hash function are not important as long as it attempts uniformity. I had this question because I have a list of names displayed to a user, and as that list grows, I want the color associations of names previously entered to be the same (so the user retains name/color associations). I realized that if I specified the list of colors in advance, this wouldn't be a problem. </p>
  
  <p>So now it's just out of curiosity -- are there hashing functions which do not change the value of previous associations as input/output sizes grow, without persistence? Sorry for the earlier confusion.</p>