Skip to content

Instantly share code, notes, and snippets.

@domkirby
Created April 11, 2025 20:06
Show Gist options
  • Save domkirby/c6941a6196f0405203f25d1155962828 to your computer and use it in GitHub Desktop.
Save domkirby/c6941a6196f0405203f25d1155962828 to your computer and use it in GitHub Desktop.
Simple sha256 for CTF
import hashlib
import sys
def hash_with_sha256(input_string):
"""Hashes the given input string using SHA-256 and returns the hexadecimal digest."""
sha256_hash = hashlib.sha256(input_string.encode('utf-8')).hexdigest()
return sha256_hash
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python sha256.py <input_string>")
sys.exit(1)
input_string = sys.argv[1]
print(hash_with_sha256(input_string))
@domkirby
Copy link
Author

call it with python3 ./sha256.py "yourthingtohash"

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