factor hash functions into their own module

older versions of PyCrypto don't provide SHA512. Dunno why.