package com.sdp.hotspot;

/**
 * Created by magq on 16/1/13.
 */
public class HashFunction {

    public static int[] getHashIndex(String key) {
        return null;
    }
}

@@ -60,109 +60,1722 @@
 .%0A *
-/%0Apublic class HashFunction %7B%0A%0A    public static int%5B%5D getHashIndex(String key) %7B%0A        return null
+ address: http://www.partow.net/programming/hashfunctions/index.html#top%0A */%0A%0Apublic class HashFunction %7B%0A    private static HashFunction ourInstance = new HashFunction();%0A%0A    public static HashFunction getInstance() %7B%0A        return ourInstance;%0A    %7D%0A%0A    private HashFunction() %7B%0A    %7D%0A%0A    public static int%5B%5D getHashIndex(String key) %7B%0A        return null;%0A    %7D%0A%0A    public long RSHash(String str) %7B%0A        int b = 378551;%0A        int a = 63689;%0A        long hash = 0;%0A        for(int i = 0; i %3C str.length(); i++) %7B%0A            hash = hash * a + str.charAt(i);%0A            a = a * b;%0A        %7D%0A        return hash;%0A    %7D%0A%0A    public long JSHash(String str) %7B%0A        long hash = 1315423911;%0A        for(int i = 0; i %3C str.length(); i++) %7B%0A            hash %5E= ((hash %3C%3C 5) + str.charAt(i) + (hash %3E%3E 2));%0A        %7D%0A        return hash;%0A    %7D%0A%0A    public long BKDRHash(String str) %7B%0A        long seed = 131;%0A        long hash = 0;%0A        for(int i = 0; i %3C str.length(); i++) %7B%0A            hash = (hash * seed) + str.charAt(i);%0A        %7D%0A        return hash;%0A    %7D%0A%0A    public long SDBMHash(String str) %7B%0A        long hash = 0;%0A        for(int i = 0; i %3C str.length(); i++) %7B%0A            hash = str.charAt(i) + (hash %3C%3C 6) + (hash %3C%3C 16) - hash;%0A        %7D%0A        return hash;%0A    %7D%0A%0A    public long DJBHash(String str) %7B%0A        long hash = 5381;%0A        for (int i = 0; i %3C str.length(); i++) %7B%0A            hash = ((hash %3C%3C 5) + hash) + str.charAt(i);%0A        %7D%0A        return hash;%0A    %7D%0A%0A    public long DEKHash(String str) %7B%0A        long hash = str.length();%0A        for(int i = 0; i %3C str.length(); i++) %7B%0A            hash = ((hash %3C%3C 5) %5E (hash %3E%3E 27)) %5E str.charAt(i);%0A        %7D%0A        return hash
 ;%0A  

add hash functions