Skip to content

Instantly share code, notes, and snippets.

@bsiver
Last active June 23, 2016 16:40
Show Gist options
  • Save bsiver/82faf3b0cb39430eae4ed862f9e97daf to your computer and use it in GitHub Desktop.
Save bsiver/82faf3b0cb39430eae4ed862f9e97daf to your computer and use it in GitHub Desktop.
content checksum computation
def compute_checksum(content):
""" Computes an md5 hash for a partial content object based on the fields in CHECKSUM_COMPARISON_FIELDS """
comparison_dict = {k : content[k] for k in CHECKSUM_COMPARISON_FIELDS}
return hashlib.md5(json.dumps(comparison_dict, sort_keys=True)).hexdigest()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment