Skip to content

Instantly share code, notes, and snippets.

@anjackson
Created November 18, 2015 22:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anjackson/f60e62ed69fee8f84f7f to your computer and use it in GitHub Desktop.
Save anjackson/f60e62ed69fee8f84f7f to your computer and use it in GitHub Desktop.
Calculate the Base32-encoded SHA-1 digest of a file at the command line.
openssl dgst -sha1 -binary $1 | python -c "import base64,sys; print base64.b32encode(sys.stdin.read())"
@anjackson
Copy link
Author

For Python 3, this works:

openssl dgst -sha1 -binary $1| python3 -c "import base64,sys; print(base64.b32encode(sys.stdin.buffer.read()))"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment