private static byte[] lmResponse(final byte[] hash, final byte[] challenge) throws NTLMEngineException {
        try {
            final byte[] keyBytes = new byte[21];
            System.arraycopy(hash, 0, keyBytes, 0, 16);
            final Key lowKey = createDESKey(keyBytes, 0);
            final Key middleKey = createDESKey(keyBytes, 7);
            final Key highKey = createDESKey(keyBytes, 14);
            final Cipher des = Cipher.getInstance("DES/ECB/NoPadding");
            des.init(Cipher.ENCRYPT_MODE, lowKey);
            final byte[] lowResponse = des.doFinal(challenge);
            des.init(Cipher.ENCRYPT_MODE, middleKey);
            final byte[] middleResponse = des.doFinal(challenge);
            des.init(Cipher.ENCRYPT_MODE, highKey);
            final byte[] highResponse = des.doFinal(challenge);
            final byte[] lmResponse = new byte[24];
            System.arraycopy(lowResponse, 0, lmResponse, 0, 8);
            System.arraycopy(middleResponse, 0, lmResponse, 8, 8);
            System.arraycopy(highResponse, 0, lmResponse, 16, 8);
            return lmResponse;
        } catch (final Exception e) {
            throw new NTLMEngineException(e.getMessage(), e);
        }
    }
Creates the LM Response from the given hash and Type 2 challenge.

@param hash
           The LM or NTLM Hash.
@param challenge
           The server challenge from the Type 2 message.

@return The response (either LM or NTLM, depending on the provided hash).
httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/NTLMEngineImpl.java