lol whoops

This commit is contained in:
brent s
2019-08-19 00:16:03 -04:00
parent 31826960c1
commit 3848a0bf7e
2 changed files with 7 additions and 4 deletions

View File

@@ -245,8 +245,11 @@ class BootSync(object):
return (None)
if not os.path.isfile(fpathname):
return(None)
if hashtype not in hashlib.algorithms_available:
raise ValueError('Hashtype {0} is not supported on this system'.format(hashtype))
hasher = getattr(hashlib, hashtype)
fpathname = os.path.abspath(os.path.expanduser(fpathname))
_hash = hashlib.sha512()
_hash = hasher()
with open(fpathname, 'rb') as fh:
_hash.update(fh.read())
return (_hash.hexdigest())