Encode password and password attempt in check_password.