Public
Authored by noirscape :8ball:

Simple hasher

Written specifically to help with robocop-ng, since it's new hashing method contains a couple of rather odd hashes that you may not be able to find converters for online.

Just give the type of hash as the first argument and the string to hash as arguments.

ie.

$ python verify.py sha1 "test"
a94a8fe5ccb19ba61c4c0873d391e987982fbbd3

Doesnt need any external libs, everything is in the stdlib of python.

Also doesn't work on python 2 since fuck python 2.

(Fun fact, this description is longer than the program itself.)

verify.py 474 Bytes
import argparse
import hashlib

# Simple hashing program.

def parse_arguments():
    parser = argparse.ArgumentParser()
    parser.add_argument("HASH", choices=hashlib.algorithms_guaranteed - {"shake_128", "shake_256"}, help="hash algorithm to use")
    parser.add_argument("STRING", type=str, help="string to parse")
    return parser.parse_args()

arguments = parse_arguments()

print(hashlib.new(arguments.HASH, arguments.STRING.encode('utf-8')).hexdigest()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment