Skip to content

Instantly share code, notes, and snippets.

@nikola
Created November 11, 2014 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikola/0c128fa970ffbb40b90d to your computer and use it in GitHub Desktop.
Save nikola/0c128fa970ffbb40b90d to your computer and use it in GitHub Desktop.
Generate Chrome Application ID
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