mobiledefense/google_safe_browsing — pull request #8 by pawanpoudel (2013-07-15 17:31:03+00:00)
Title: Add support for accepting URL hashes

Currently, the `google_safe_browsing` gem allows URLs lookup only. The URLs to be looked up are not hashed so the server knows which URLs the API users have looked up, which is a privacy concern. Google [recommends](https://developers.google.com/safe-browsing/) that API users exchange data with the server using hashed URLs so the server never knows the actual URLs queried by the clients.

This pull request adds a public method called `lookup_url_hashes` that allows the API users to send SHA256 hashes instead of an URL. The return value from `lookup_url_hashes` method is exactly the same as `lookup` method: a string ( either `malware` or `phishing` ) for the name of the black list which the url appears on, or `nil` if the url is not on Google's list..

To check url (SHA256) hashes for badness, you need to do:
```
url_hashes = [ '52d3df0ed60c46f336c131bf2ca454f73bafdc4b04dfa2aea80746f5ba9e6d1c',
'999f7d93aa3d4a1a94cccfb4ea96bc2e28fd48020a481aa2dc7e215f3ce27bc0']
GoogleSafeBrowsing::APIv2.lookup_url_hashes(url_hashes)
```