Created
July 7, 2011 12:54
-
-
Save gcollazo/1069442 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
from hashlib import sha1 | |
def main(): | |
print hashfile("~/Desktop/lift-columns.png") | |
def hashfile(path): | |
f = open(path) | |
file_hash = githash(f.read()) | |
f.close() | |
return file_hash | |
def githash(data): | |
s = sha1() | |
s.update("blob %u\0" % len(data)) | |
s.update(data) | |
return s.hexdigest() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment