Skip to content

Instantly share code, notes, and snippets.

@lukifer195
Created July 30, 2020 07:27
Show Gist options
  • Save lukifer195/7237fd5de746ff92f76152a33d32b7b9 to your computer and use it in GitHub Desktop.
Save lukifer195/7237fd5de746ff92f76152a33d32b7b9 to your computer and use it in GitHub Desktop.
Convert string input to hash via arg
import hashlib
import sys
import os
if __name__ == '__main__':
try:
arg0 = sys.argv[1]
hash_object = hashlib.sha1(arg0.encode())
pbHash = hash_object.hexdigest()
sys.stdout.write(pbHash)
sys.exit()
except Exception:
arg0 = input('your string: ')
hash_object = hashlib.sha1(arg0.encode())
pbHash = hash_object.hexdigest()
os.system('cls')
sys.stdout.write(pbHash)
input()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment