Reorder hashes and fix sha512