Use single version of sendPasswordMessage

Thanks to feedback, change back to using single sendPasswordMessage
function and tidy up the MD5 handling to be more readable.