当前位置: 首页>>代码示例>>Java>>正文


Java Hashing.murmur3_32方法代码示例

本文整理汇总了Java中com.google.common.hash.Hashing.murmur3_32方法的典型用法代码示例。如果您正苦于以下问题:Java Hashing.murmur3_32方法的具体用法?Java Hashing.murmur3_32怎么用?Java Hashing.murmur3_32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.hash.Hashing的用法示例。


在下文中一共展示了Hashing.murmur3_32方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isFullDuplicate

import com.google.common.hash.Hashing; //导入方法依赖的package包/类
public boolean isFullDuplicate(IHttpRequestResponse messageInfo) {
    PrintWriter stdout = new PrintWriter(callbacks.getStdout(), true);
    IResponseInfo respInfo = helpers.analyzeResponse(messageInfo.getResponse());

    if (dubBloomFilter == null) return false;

    HashFunction m_hash = Hashing.murmur3_32();
    if (helpers.bytesToString(messageInfo.getResponse()).length() > respInfo.getBodyOffset()) {
        String body = helpers.bytesToString(messageInfo.getResponse()).substring(respInfo.getBodyOffset());

        /* full-dub detection */
        String dedupHashValue = m_hash.hashBytes(helpers.stringToBytes(body)).toString();
        if (dubBloomFilter.mightContain(dedupHashValue)) {
            return true;
        }
        dubBloomFilter.put(dedupHashValue);
    }

    return false;
}
 
开发者ID:yandex,项目名称:burp-molly-scanner,代码行数:21,代码来源:EntryPointDeduplicator.java

示例2: fingerprintMac

import com.google.common.hash.Hashing; //导入方法依赖的package包/类
/**
 * Build a stringified MAC address using the ClusterMetadata hash for uniqueness.
 * Form of MAC is "02:eb" followed by four bytes of clusterMetadata hash.
 */
static String fingerprintMac(ClusterMetadata cm) {
    if (cm == null) {
        return DEFAULT_MAC;
    }

    HashFunction hf = Hashing.murmur3_32();
    HashCode hc = hf.newHasher().putObject(cm, ClusterMetadata.HASH_FUNNEL).hash();
    int unqf = hc.asInt();

    StringBuilder sb = new StringBuilder();
    sb.append("02:eb");
    for (int i = 0; i < 4; i++) {
        byte b = (byte) (unqf >> i * 8);
        sb.append(String.format(":%02X", b));
    }
    return sb.toString();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:ProbedLinkProvider.java

示例3: isDuplicateURL

import com.google.common.hash.Hashing; //导入方法依赖的package包/类
public boolean isDuplicateURL(IHttpRequestResponse messageInfo) {
    if (dubBloomFilter == null) return false;

    IRequestInfo requestInfo = helpers.analyzeRequest(messageInfo.getHttpService(), messageInfo.getRequest());
    if (requestInfo == null) return true;

    HashFunction m_hash = Hashing.murmur3_32();
    /* don't know if Burp has a deduplication here, make it sure */
    String hashInput = requestInfo.getUrl().getPath() + "?";
    if (requestInfo.getUrl().getQuery() != null && requestInfo.getUrl().getQuery().length() > 0) {
        List<String> qsList = Splitter.on('&').trimResults().splitToList(requestInfo.getUrl().getQuery());
        if (qsList.size() > 0) {
            for (String param : qsList) {
                for (String k : Splitter.on("=").splitToList(param)) {
                    hashInput += "&" + k;
                }
            }
        }
    }

    String dedupHashValue = "URL:" + requestInfo.getMethod() + m_hash.hashBytes(helpers.stringToBytes(hashInput)).toString();
    if (dubBloomFilter.mightContain(dedupHashValue)) {
        return true;
    }
    dubBloomFilter.put(dedupHashValue);
    return false;
}
 
开发者ID:yandex,项目名称:burp-molly-scanner,代码行数:28,代码来源:EntryPointDeduplicator.java

示例4: generateBucketMap

import com.google.common.hash.Hashing; //导入方法依赖的package包/类
private void generateBucketMap(){
	hash=Hashing.murmur3_32(seed);//计算一致性哈希的对象
	for(int i=0;i<count;i++){//构造一致性哈希环,用TreeMap表示
		StringBuilder hashName=new StringBuilder("SHARD-").append(i);
		for(int n=0,shard=virtualBucketTimes*getWeight(i);n<shard;n++){
			bucketMap.put(hash.hashUnencodedChars(hashName.append("-NODE-").append(n)).asInt(),i);
		}
	}
	weightMap=null;
}
 
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:11,代码来源:PartitionByMurmurHash.java

示例5: hash

import com.google.common.hash.Hashing; //导入方法依赖的package包/类
private int hash() {
    Funnel<TrafficSelector> selectorFunnel = (from, into) -> from.criteria()
            .stream()
            .forEach(c -> into.putString(c.toString(), Charsets.UTF_8));

    HashFunction hashFunction = Hashing.murmur3_32();
    HashCode hashCode = hashFunction.newHasher()
            .putString(deviceId.toString(), Charsets.UTF_8)
            .putObject(selector, selectorFunnel)
            .putInt(priority)
            .putInt(tableId)
            .hash();

    return hashCode.asInt();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:DefaultFlowRule.java

示例6: forName

import com.google.common.hash.Hashing; //导入方法依赖的package包/类
public static HashFunction forName(String name) {
    switch (name) {
        case "murmur3_32":
            return Hashing.murmur3_32();
        case "murmur3_128":
            return Hashing.murmur3_128();
        case "crc32":
            return Hashing.crc32();
        case "md5":
            return Hashing.md5();
        default:
            throw new IllegalArgumentException("Can't find hash function with name " + name);
    }
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:15,代码来源:MiscUtils.java


注:本文中的com.google.common.hash.Hashing.murmur3_32方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。