Revert "Still working on weird behavior, minor fixes."

This reverts commit b5484991991dd42843a6534a300ec71f8fede645.
fixed memory bugs for sha2-512, doesn't give right output though.