enjoy 3.3 release ^_^

This commit is contained in:
James
2017-11-21 22:43:34 +08:00
parent 28eb105ffa
commit 61aa1d2082
70 changed files with 3378 additions and 299 deletions

View File

@@ -20,10 +20,22 @@ import java.security.MessageDigest;
public class HashKit {
public static final long FNV_OFFSET_BASIS_64 = 0xcbf29ce484222325L;
public static final long FNV_PRIME_64 = 0x100000001b3L;
private static final java.security.SecureRandom random = new java.security.SecureRandom();
private static final char[] HEX_DIGITS = "0123456789abcdef".toCharArray();
private static final char[] CHAR_ARRAY = "_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();
public static long fnv1a64(String key) {
long hash = FNV_OFFSET_BASIS_64;
for(int i=0, size=key.length(); i<size; i++) {
hash ^= key.charAt(i);
hash *= FNV_PRIME_64;
}
return hash;
}
public static String md5(String srcStr){
return hash("MD5", srcStr);
}