1234567891011 |
- def hash_function(hash_type, object):
- hashed_file = {
- 'sha256': hashlib.sha256(object).hexdigest(),
- 'sha512': hashlib.sha512(object).hexdigest(),
- 'md5': hashlib.md5(object).hexdigest()
- }
- if hash_type.lower() in hashed_file.keys():
- return hashed_file[hash_type.lower()]
- else:
- print('[!] Wrong or non existing hash type')
- sys.exit(1)
|