Created
April 11, 2025 20:06
-
-
Save domkirby/c6941a6196f0405203f25d1155962828 to your computer and use it in GitHub Desktop.
Simple sha256 for CTF
This file contains hidden or 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 | |
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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
call it with
python3 ./sha256.py "yourthingtohash"