Implement the password exchange logic