def _getSha1hexDigest(thing, isfile=False):
 digester = hashlib.sha1()
 if isfile:
  filename = thing
  if os.path.isfile(filename):
   f = open(filename, 'rb')
   digester.update(f.read())
   f.close()
  else:
   return None
 else:
  digester.update(str(thing))
 return digester.hexdigest()

def _getSha1hexDigest ( thing , isfile = False ) : digester = hashlib . sha1 ( ) if isfile : filename = thing if os . path . isfile ( filename ) : f = open ( filename , 'rb' ) digester . update ( f . read ( ) ) f . close ( ) else : return None else : digester . update ( str ( thing ) ) return digester . hexdigest ( )
returns base64 / hex encoded sha1 digest of str .