Created
August 22, 2021 11:44
-
-
Save mcbhenwood/052bac96efff8bbdd615c881d445092a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
EXAMPLE_COMPANY = {"name": "Acme Ltd", "id": 1234} | |
short_hash_of_id = hashlib.sha256( | |
str(EXAMPLE_COMPANY["id"]).encode("utf-8") | |
).hexdigest()[:7] | |
print(f"Folder name: {EXAMPLE_COMPANY['name']} ({short_hash_of_id})") | |
# Example output: | |
# Folder name: Acme Ltd (03ac674) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment