Update sha512 usage for py3

Requires an explicit call to encode a potentially unicode string read from a
file-like object.