Last active
January 31, 2017 06:05
-
-
Save cipepser/6b13fac1db57d676e72bb39d258e6888 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Add(bf *BloomFilter, element string) { | |
hash := GetMD5Hash(element) | |
hashA := hash[:int(len(hash)/2)] // 前半 | |
hashB := hash[int(len(hash)/2):] // 後半 | |
i64_hashA, _ := strconv.ParseInt(hashA, 16, 64) | |
i64_hashB, _ := strconv.ParseInt(hashB, 16, 64) | |
for i := 0; i < k; i++ { | |
bf.BloomFilter[DoubleHashing(i64_hashA, i64_hashB, i)] = true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment