Created
April 9, 2017 18:12
-
-
Save nathankrishnan/46f4c640c59ddee7de6dd1aacd4db1c8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
let badDomains = BloomFilter<String>(size: 1024, hashFunctions: [djb2, sdbm]) | |
badDomains.insert("badguys.com") | |
badDomains.insert("drevil.me") | |
badDomains.insert("virus.io") | |
let websiteToLoad = NSURL(string: "http://virus.io") | |
if let validDomain = websiteToLoad?.host { | |
if badDomains.query(validDomain) { | |
print("The website is most likely bad!") | |
} else { | |
print("This website doesn't exist in our dossier. Let's proceed.") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment