Skip to content

Instantly share code, notes, and snippets.

@jobel-code
Last active February 8, 2020 13:46
Show Gist options
  • Select an option

  • Save jobel-code/4ab21c4e4dad1628b8d5441943c19ff3 to your computer and use it in GitHub Desktop.

Select an option

Save jobel-code/4ab21c4e4dad1628b8d5441943c19ff3 to your computer and use it in GitHub Desktop.
import base64
import hashlib
input = "string to encode"
result = base64.b64encode(hashlib.sha1(str.encode(input)))
print(result)
# Google Cloud Storage transfer requires a base64-encoded MD5 hash of 24 characters long
hash = hashlib.md5()
hash.update('string_chunk')
hash.digest().encode('base64').strip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment