static byte[] ntlm2SessionResponse(final byte[] ntlmHash,final byte[] challenge,final byte[] clientChallenge) throws AuthenticationException {
  try {
    final MessageDigest md5=MessageDigest.getInstance("MD5");
    md5.update(challenge);
    md5.update(clientChallenge);
    final byte[] digest=md5.digest();
    final byte[] sessionHash=new byte[8];
    System.arraycopy(digest,0,sessionHash,0,8);
    return lmResponse(ntlmHash,sessionHash);
  }
 catch (  Exception e) {
    if (e instanceof AuthenticationException)     throw (AuthenticationException)e;
    throw new AuthenticationException(e.getMessage(),e);
  }
}

static byte [ ] ntlm2SessionResponse ( final byte [ ] ntlmHash , final byte [ ] challenge , final byte [ ] clientChallenge ) throws AuthenticationException { try { final MessageDigest md5 = MessageDigest . getInstance ( "MD5" ) ; md5 . update ( challenge ) ; md5 . update ( clientChallenge ) ; final byte [ ] digest = md5 . digest ( ) ; final byte [ ] sessionHash = new byte [ 8 ] ; System . arraycopy ( digest , 0 , sessionHash , 0 , 8 ) ; return lmResponse ( ntlmHash , sessionHash ) ; } catch ( Exception e ) { if ( e instanceof AuthenticationException ) throw ( AuthenticationException ) e ; throw new AuthenticationException ( e . getMessage ( ) , e ) ; } }
calculates the ntlm2 session response for the given challenge , using the specified password and client challenge .
