

def hash(hash_type, input_text):
    'Hash input_text with the algorithm choice'
    hash_funcs = {
        'MD5': hashlib.md5,
        'SHA1': hashlib.sha1,
        'SHA224': hashlib.sha224,
        'SHA256': hashlib.sha256,
        'SHA384': hashlib.sha384,
        'SHA512': hashlib.sha512,
    }
    if (input_text == 'All'):
        hash_type = ['MD5', 'SHA1', 'SHA224', 'SHA256', 'SHA384', 'SHA512']
    else:
        hash_type = [hash_type]
    return [{
        'Algorithm': h,
        'Hash': hash_funcs[h](input_text).hexdigest(),
    } for h in hash_type]

dataset/ETHPy150Open mosesschwartz/scrypture/scrypture/demo_scripts/Security/file_hash.py hash/VarMisuse@64/106 `hash_type`->`input_text`