minhash是一种基于jaccard index 相似度的算法.属于LSH(Location Sensitive Hash)家族中的一员. jaccard index :有两个集合A={a , b , c , d , e } ,B={a , e , f , g},根据jaccard index 来计算两个集合的相似度Jaccard(A,B)=|A∩B| / |AUB|=2/7≍0.2857 当集合较大或者集合数量过多时,直接计算集合交集与并集过于耗时,因此提出了minhash方法. minha
本文搜集了一些字符串的常用hash函数. 范例1:判断两个单词是否含有相同的字母,此时我们可以用hash做.例如,“aaabb”与"aabb"含有相同的单词.(参考:http://kmplayer.iteye.com/blog/656782) #include <iostream> using namespace std; int hash(const char* a) //hash函数设计到位,节约了空间,当然我们也可以用bitset { int tmp=0; while
基于Hash函数的PRNG 流程非常类似于对称密码的CTR工作模式 算法的伪码如下 m = ⌈n/outlen⌉ data = V W = the null String for i = 1 to m wi = H(data) W = W || wi data = (data + 1) mod 2seedlen return leftmost n bits of W 说明: V是种子,seedlen为V的长度,n是需要的输出位数,H是Hash函数 对于诸如SHA-2等强密码学Hash算法,目前还