Ensuring SHA/MD5 is correctly encoded and decoded