哈希(Hask)
基本概念编辑
性质
常用HASH函数
构造方法
处理冲突方法
查找性能分析
散列函数应用
哈希函数
文件的hash值
hash文件
userhash
散列表编辑
扩展编辑
命令描述编辑
语法
选项说明
|
选项
|
说明
|
|
-l
|
显示哈希表,包括路径
|
|
-r
|
清除哈希表
|
|
-p <path> <name>
|
向哈希表中增加内容
|
|
-t <command>
|
显示指定命令的完整路径
|
HASH命令
- 中文名
- 哈希算法
- 外文名
- Hash
- 别 称
- 散列
- 应用学科
- 程序加密
- 适用领域范围
- 网络,软件
基本特点编辑
内容编辑
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
class GeneralHashFunctionLibrary{/*RSHash*/ public long RSHash(String str) { int b = 378551; int a = 63689; long hash = 0; for(int i = 0; i < str.length(); i++) { hash = hash * a + str.charAt(i); a = a * b; } return hash; } /*JSHash*/ public long JSHash(String str) { long hash = 1315423911; for(int i = 0; i < str.length(); i++) hash ^= ((hash << 5) + str.charAt(i) + (hash >> 2)); return hash; } /*PJWHash*/ public long PJWHash(String str) { long BitsInUnsignedInt = (long)(4 * 8); long ThreeQuarters = (long)((BitsInUnsignedInt * 3) / 4); long OneEighth = (long)(BitsInUnsignedInt / 8); long HighBits = (long)(0xFFFFFFFF)<<(BitsInUnsignedInt-OneEighth); long hash = 0; long test = 0; for(int i = 0; i < str.length(); i++) { hash = (hash << OneEighth) + str.charAt(i); if((test = hash & HighBits) != 0) hash = ((hash ^ (test >> ThreeQuarters)) & (~HighBits)); } return hash; } /*ELFHash*/ public long ELFHash(String str) { long hash = 0; long x = 0; for(int i = 0; i < str.length(); i++) { hash = (hash << 4) + str.charAt(i); if(( x = hash & 0xF0000000L) != 0) hash ^= ( x >> 24); hash &= ~x; } return hash; } /*BKDRHash*/ public long BKDRHash(String str) { long seed = 131;//31131131313131131313etc.. long hash = 0; for(int i = 0; i < str.length(); i++) hash = (hash * seed) + str.charAt(i); return hash; } /*SDBMHash*/ public long SDBMHash(String str) { long hash = 0; for(int i = 0; i < str.length(); i++) hash = str.charAt(i) + (hash << 6) + (hash << 16) - hash; return hash; } /*DJBHash*/ 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; } /*DEKHash*/ public long DEKHash(String str) { long hash = str.length(); for(int i = 0; i < str.length(); i++) hash = ((hash << 5) ^ (hash >> 27)) ^ str.charAt(i); return hash; } /*BPHash*/ public long BPHash(String str) { long hash=0; for(int i = 0;i < str.length(); i++) hash = hash << 7 ^ str.charAt(i); return hash; } /*FNVHash*/ public long FNVHash(String str) { long fnv_prime = 0x811C9DC5; long hash = 0; for(int i = 0; i < str.length(); i++) { hash *= fnv_prime; hash ^= str.charAt(i); } return hash; } /*APHash*/ long APHash(String str) { long hash = 0xAAAAAAAA; for(int i = 0; i < str.length(); i++) { if((i & 1) == 0) hash ^=((hash << 7) ^ str.charAt(i) ^ (hash >> 3)); else hash ^= (~((hash << 11) ^ str.charAt(i) ^ (hash >> 5))); } return hash; }} |
计算方法编辑
哈希(Hask)的更多相关文章
- [PHP内核探索]PHP中的哈希表
在PHP内核中,其中一个很重要的数据结构就是HashTable.我们常用的数组,在内核中就是用HashTable来实现.那么,PHP的HashTable是怎么实现的呢?最近在看HashTable的数据 ...
- java单向加密算法小结(2)--MD5哈希算法
上一篇文章整理了Base64算法的相关知识,严格来说,Base64只能算是一种编码方式而非加密算法,这一篇要说的MD5,其实也不算是加密算法,而是一种哈希算法,即将目标文本转化为固定长度,不可逆的字符 ...
- Java 哈希表运用-LeetCode 1 Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number. The ...
- 网络安全——Base64编码、MD5、SHA1-SHA512、HMAC(SHA1-SHA512)哈希
据说今天520是个好日子,为什么我想起的是502.500.404这些?还好服务器没事! 一.Base64编码 Base64编码要求把3个8位字节(3*8=24)转化为4个6位的字节(4*6=24),之 ...
- Oracle 哈希连接原理
<基于Oracle的sql优化>里关于哈希连接的原理介绍如下: 哈希连接(HASH JOIN)是一种两个表在做表连接时主要依靠哈希运算来得到连接结果集的表连接方法. 在Oracle 7.3 ...
- SQL连接操作符介绍(循环嵌套, 哈希匹配和合并连接)
今天我将介绍在SQLServer 中的三种连接操作符类型,分别是:循环嵌套.哈希匹配和合并连接.主要对这三种连接的不同.复杂度用范例的形式一一介绍. 本文中使用了示例数据库AdventureWorks ...
- BZOJ 3555: [Ctsc2014]企鹅QQ [字符串哈希]【学习笔记】
3555: [Ctsc2014]企鹅QQ Time Limit: 20 Sec Memory Limit: 256 MBSubmit: 2046 Solved: 749[Submit][Statu ...
- [bzoj3207][花神的嘲讽计划Ⅰ] (字符串哈希+主席树)
Description 背景 花神是神,一大癖好就是嘲讽大J,举例如下: “哎你傻不傻的![hqz:大笨J]” “这道题又被J屎过了!!” “J这程序怎么跑这么快!J要逆袭了!” …… 描述 这一天D ...
- minHash最小哈希原理
minHash最小哈希原理 收藏 初雪之音 发表于 9个月前 阅读 208 收藏 9 点赞 1 评论 0 摘要: 在数据挖掘中,一个最基本的问题就是比较两个集合的相似度.通常通过遍历这两个集合中的所有 ...
随机推荐
- [转载] Linux下高并发socket最大连接数所受的各种限制
原文: http://mp.weixin.qq.com/s?__biz=MzAwNjMxNjQzNA==&mid=207772333&idx=1&sn=cfc8aadb422f ...
- [转载] Codis作者黄东旭细说分布式Redis架构设计和踩过的那些坑们
原文: http://mp.weixin.qq.com/s?__biz=MzAwMDU1MTE1OQ==&mid=208733458&idx=1&sn=691bfde670fb ...
- IO端口、IO内存、IO空间、内存空间的含义和联系
1,IO空间:X86一个特有的空间,与内存空间独立的空间,同样利用IO空间可以操作数据,只不过是利用对应的IO端口操作函数,例如inb(), inbw(), inl(); outb(), outw() ...
- 在PC端或移动端应用中接入商业QQ的方法
今天看博友的博客学习了一种很有用的方法: 在页面中需要接入企业的QQ,访问网址:http://shang.qq.com/widget/consult.php.(就是API接口),然后你只需要登录你的Q ...
- js 函数-Tom
函数类型 在ECMAScript 中有三种函数类型:函数声明,函数表达式和函数构造器创建的函数.每一种都有自己的特点. 函数声明 函数声明(缩写为FD)是这样一种函数: 有一个特定的名称 在源码中的位 ...
- 读convolutional Neural Networks Applied to House Numbers Digit Classification 的收获。
本文以下内容来自读论文以后认为有价值的地方,论文来自:convolutional Neural Networks Applied to House Numbers Digit Classificati ...
- 转!!Java中关于Null的9个解释(Java Null详解)
对于Java程序员来说,null是令人头痛的东西.时常会受到空指针异常(NPE)的骚扰.连Java的发明者都承认这是他的一项巨大失误.Java为什么要保留null呢?null出现有一段时间了,并且我认 ...
- phalcon: Profiling分析 profilter / Plugin结合,dispatcher调度控制器 监听sql执行日志
个人觉得profilter 跟 logger 功能差不多,logger的功能在于写入,profilter功能在于sql后及时显示分析.都是对sql执行的的分析:一个是写入log文件,一个是直接在页面展 ...
- 利用Github和Hexo搭建独立的个人博客--基础篇
利用Github和Hexo搭建独立的个人博客--基础篇 摘要:本文主要参考了使用hexo和Github上创建自己的博客.如何搭建一个独立博客--简明Github Pages与Hexo教程和使用GitH ...
- 3.3 使用Code First数据库迁移
当Entity Framework Code First的数据模型发生异动时,默认会引发一个System.InvalidOpertaionException异常.一种解决方法是在Global.asax ...