MD5 digest compatibility tests, small fixes and refactoring