Skip to content

Instantly share code, notes, and snippets.

@tsavola
Created April 3, 2018 11:41
Show Gist options
  • Save tsavola/1efbf6de95ff8dd1fa0701ae28c21b20 to your computer and use it in GitHub Desktop.
Save tsavola/1efbf6de95ff8dd1fa0701ae28c21b20 to your computer and use it in GitHub Desktop.
Python 2/3 oneliner for printing an URL-safe base-64 SHA-384 digest of file contents.
import base64, hashlib, sys; h = hashlib.new("sha384"); h.update(open(sys.argv[1], "rb").read()); print(base64.urlsafe_b64encode(h.digest()).decode())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment