def get_nt_challenge_response(self, lm_challenge_response,<EOL>server_certificate_hash=None, cbt_data=None):
if self._negotiate_flags &NegotiateFlags.NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY andself._ntlm_compatibility < <NUM_LIT:3>:<EOL><INDENT>response, session_base_key =self._get_NTLM2_response(self._password,<EOL>self._server_challenge,<EOL>self._client_challenge)<EOL>lm_hash = comphash._lmowfv1(self._password)<EOL>key_exchange_key =compkeys._get_exchange_key_ntlm_v1(self._negotiate_flags,<EOL>session_base_key,<EOL>self._server_challenge,<EOL>lm_challenge_response,<EOL>lm_hash)<EOL>target_info = None<EOL><DEDENT>elif <NUM_LIT:0> <= self._ntlm_compatibility < <NUM_LIT:3>:<EOL><INDENT>response, session_base_key =self._get_NTLMv1_response(self._password,<EOL>self._server_challenge)<EOL>lm_hash = comphash._lmowfv1(self._password)<EOL>key_exchange_key =compkeys._get_exchange_key_ntlm_v1(self._negotiate_flags,<EOL>session_base_key,<EOL>self._server_challenge,<EOL>lm_challenge_response,<EOL>lm_hash)<EOL>target_info = None<EOL><DEDENT>else:<EOL><INDENT>if self._server_target_info is None:<EOL><INDENT>target_info = ntlm_auth.messages.TargetInfo()<EOL><DEDENT>else:<EOL><INDENT>target_info = self._server_target_info<EOL><DEDENT>if target_info[AvId.MSV_AV_TIMESTAMP] is None:<EOL><INDENT>timestamp = get_windows_timestamp()<EOL><DEDENT>else:<EOL><INDENT>timestamp = target_info[AvId.MSV_AV_TIMESTAMP]<EOL>target_info[AvId.MSV_AV_FLAGS] =struct.pack("<STR_LIT>", AvFlags.MIC_PROVIDED)<EOL><DEDENT>if server_certificate_hash is not None and cbt_data is None:<EOL><INDENT>certificate_digest = base64.b16decode(server_certificate_hash)<EOL>cbt_data = GssChannelBindingsStruct()<EOL>cbt_data[cbt_data.APPLICATION_DATA] =b'<STR_LIT>' + certificate_digest<EOL><DEDENT>if cbt_data is not None:<EOL><INDENT>cbt_bytes = cbt_data.get_data()<EOL>cbt_hash = hashlib.md5(cbt_bytes).digest()<EOL>target_info[AvId.MSV_AV_CHANNEL_BINDINGS] = cbt_hash<EOL><DEDENT>response, session_base_key =self._get_NTLMv2_response(self._user_name, self._password,<EOL>self._domain_name,<EOL>self._server_challenge,<EOL>self._client_challenge,<EOL>timestamp, target_info)<EOL>key_exchange_key =compkeys._get_exchange_key_ntlm_v2(session_base_key)<EOL><DEDENT>return response, key_exchange_key, target_info<EOL>
[MS-NLMP] v28.0 2016-07-14

3.3.1 - NTLM v1 Authentication
3.3.2 - NTLM v2 Authentication

This method returns the NtChallengeResponse key based on the
ntlm_compatibility chosen and the target_info supplied by the
CHALLENGE_MESSAGE. It is quite different from what is set in the
document as it combines the NTLMv1, NTLM2 and NTLMv2 methods into one
and calls separate methods based on the ntlm_compatibility value
chosen.

:param lm_challenge_response: The LmChallengeResponse calculated
    beforehand, used to get the key_exchange_key value
:param server_certificate_hash: This is deprecated and will be removed
    in a future version, use cbt_data instead
:param cbt_data: The GssChannelBindingsStruct to bind in the NTLM
    response
:return response: (NtChallengeResponse) - The NT response to the server
    challenge. Computed by the client
:return session_base_key: (SessionBaseKey) - A session key calculated
    from the user password challenge
:return target_info: (AV_PAIR) - The AV_PAIR structure used in the
    nt_challenge calculations