Created
November 11, 2014 16:18
-
-
Save nikola/0c128fa970ffbb40b90d to your computer and use it in GitHub Desktop.
Generate Chrome Application ID
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
import hashlib | |
def getChromeApplicationId(pathname): | |
if len(pathname) > 1 and pathname[0].islower() and pathname[1] == ":": | |
pathname = pathname[0].upper() + pathname[1:] | |
pathname = pathname.encode("utf-16le") | |
offset = ord("a") | |
applicationId = "".join([chr(int(digit, 16) + offset) for digit in hashlib.sha256(pathname).hexdigest()[:32]]) | |
return applicationId |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment