當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。