以下为64位和32位的hash值计算方法
public class HashUtil {

    private static final long FNV_64_INIT = 0xcbf29ce484222325L;
private static final long FNV_64_PRIME = 0x100000001b3L; private static final long FNV_32_INIT = 2166136261L;
private static final long FNV_32_PRIME = 16777619; public static Long getUnsignedHash64(final String seed) {
Long res = 0L;
res = FNV_64_INIT;
int len = seed.length();
for (int i = 0; i < len; i++) {
res *= FNV_64_PRIME;
res ^= seed.charAt(i);
}
if (res < 0) res = -res;
return res;
} public static Long getUnsignedHash32(final String seed) {
Long res = 0L;
res = FNV_32_INIT;
int len = seed.length();
for (int i = 0; i < len; i++) {
res *= FNV_32_PRIME;
res ^= seed.charAt(i);
}
if (res < 0) res = -res;
return res;
} }

最新文章

  1. JavaWeb——Listener
  2. TextView使用大全
  3. iOS 10 都有什么改变?
  4. .NET 获取客户端的操作系统版本、浏览器版本和IP地址
  5. CentOS 6.5 zabbix 3.0.4 乱码问题
  6. python3爬虫再探之EXCEL
  7. Google浏览器的缓存文件过大(mega网站导致的)
  8. App.config自定义节点读取
  9. murri
  10. CVPR论文《100+ Times Faster Weighted Median Filter (WMF)》的实现和解析(附源代码)。
  11. bzoj3437 小P的牧场(斜率优化dp)
  12. Halcon示例:bottlet.hdev 光学字符识别(创建OCR)
  13. sql2012包含数据库,快速生成用户tsql脚本
  14. 对象关系_many2many
  15. cocos2d-x学习记录5——CCTransition场景过渡
  16. 【UVA1401】Remember the Word Trie+dp
  17. mysql数据优化--数据库结构的优化
  18. [Javascript] Coding interview problem: Scheduler functional way
  19. 第二篇-bmob云端服务器的发现
  20. js判断移动设备

热门文章

  1. sql 储存过程的使用
  2. luogu P3707 [SDOI2017]相关分析
  3. 【通信】JDK中的URLConnection参数详解
  4. B - Frogger 最短路变形('最长路'求'最短路','最短路'求'最长路')
  5. mysql 案例~ 分区表
  6. js sort方法根据数组中对象的某一个属性值进行排序
  7. SpringBoot2.x个性化启动banner设置和debug日志
  8. ubuntu 14.04界面美化
  9. 在手机的浏览器上通过连接打开App
  10. DBSCAN密度聚类