private bool VerifyPassword(string password, UserData userDetailsToVerify)
        {
            string hash;
            string salt;

            _passwordHashAlgorithm.Hash(password, out hash, out salt);
            return(_passwordHashAlgorithm.Verify(password, userDetailsToVerify.Hash, userDetailsToVerify.Salt));
        }
        public void Handle(UserManagementMessage.ChangePassword message)
        {
            string hash;
            string salt;

            _passwordHashAlgorithm.Hash(message.NewPassword, out hash, out salt);
            ReadUpdateWriteReply(
                message, data =>
            {
                if (_passwordHashAlgorithm.Verify(message.CurrentPassword, data.Hash, data.Salt))
                {
                    return(data.SetPassword(hash, salt));
                }

                ReplyUnauthorized(message);
                return(null);
            }, resetPasswordCache: true);
        }