Refactored hash calculation to avoid md5 and to be used as an utility
function.