title: Help needed with perl crypt function
body: <p>I am trying to generate a unique string/id given another relatively large string(consisting of a directory path name), thought of using crypt function. However, it's not working as expected, most probably due to my inability to understand.</p>
  
  <p>here the code &amp; output:</p>
  
  <pre><code>#!/usr/bin/perl 
  
  print "Enter a string:"; 
  chomp(my $string = &lt;STDIN&gt;); 
  
  my $encrypted_string = crypt($string,'di'); 
  
  print "\n  the encrypted string is:$encrypted_string";
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>$ perl crypt_test
   Enter a string:abcdefghi
  
   the encrypted string is:dipcn0ADeg0Jc
  $
  $ perl crypt_test
   Enter a string:abcdefgh
  
   the encrypted string is:dipcn0ADeg0Jc
  $
  $
  $ perl crypt_test
   Enter a string:abcde
  
   the encrypted string is:diGyhSp4Yvj4M
  $
  </code></pre>
  
  <p>I couldn't understand why it returned the same encrypted string for the first two strings and differed for the third one. Note that salt is same for all.</p>