hash_v.1.0_1.py 396 B

1234567891011
  1. def hash_function(hash_type, object):
  2. hashed_file = {
  3. 'sha256': hashlib.sha256(object).hexdigest(),
  4. 'sha512': hashlib.sha512(object).hexdigest(),
  5. 'md5': hashlib.md5(object).hexdigest()
  6. }
  7. if hash_type.lower() in hashed_file.keys():
  8. return hashed_file[hash_type.lower()]
  9. else:
  10. print('[!] Wrong or non existing hash type')
  11. sys.exit(1)