WebBrowser/SafeBrowsing/SafeBrowsingUrl.py

branch
safe_browsing
changeset 5817
a5f6c9128500
parent 5811
5358a3c7995f
child 5829
d3448873ced3
equal deleted inserted replaced
5816:93c74269d59e 5817:a5f6c9128500
46 """ 46 """
47 Public method to get the hashes of all possible permutations of the URL 47 Public method to get the hashes of all possible permutations of the URL
48 in canonical form. 48 in canonical form.
49 49
50 @return generator for the URL hashes 50 @return generator for the URL hashes
51 @rtype generator of str (Python2) or bytes (Python3) 51 @rtype generator of bytes
52 """ 52 """
53 for variant in self.permutations(self.canonical()): 53 for variant in self.permutations(self.canonical()):
54 urlHash = self.digest(variant) 54 urlHash = self.digest(variant)
55 yield urlHash 55 yield urlHash
56 56
204 Static method to calculate the SHA256 digest of an URL string. 204 Static method to calculate the SHA256 digest of an URL string.
205 205
206 @param url URL string 206 @param url URL string
207 @type str 207 @type str
208 @return SHA256 digest of the URL string 208 @return SHA256 digest of the URL string
209 @rtype str (Python2) or bytes (Python3) 209 @rtype bytes
210 """ 210 """
211 return hashlib.sha256(url.encode('utf-8')).digest() 211 return hashlib.sha256(url.encode('utf-8')).digest()

eric ide

mercurial