`

hash 算法

阅读更多
http://blog.csdn.net/eaglex/article/details/6310727

 public long DJBHash(String str)  
   {  
      long hash = 5381;  
      for(int i = 0; i < str.length(); i++)  
      {  
         hash = ((hash << 5) + hash) + str.charAt(i);  
      }  
      return hash;  
   }  


这个算法是Daniel J.Bernstein 教授发明的,是目前公布的最有效的哈希函数。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics