private static byte[] lmHash(final char[] password) throws NTLMEngineException {
        try {
            final char[] tmp = new char[password.length];
            for (int i = 0; i < password.length; i++) {
                tmp[i] = Character.toUpperCase(password[i]);
            }
            final byte[] oemPassword = new ByteArrayBuilder().append(tmp).toByteArray();
            final int length = Math.min(oemPassword.length, 14);
            final byte[] keyBytes = new byte[14];
            System.arraycopy(oemPassword, 0, keyBytes, 0, length);
            final Key lowKey = createDESKey(keyBytes, 0);
            final Key highKey = createDESKey(keyBytes, 7);
            final byte[] magicConstant = "KGS!@#$%".getBytes(StandardCharsets.US_ASCII);
            final Cipher des = Cipher.getInstance("DES/ECB/NoPadding");
            des.init(Cipher.ENCRYPT_MODE, lowKey);
            final byte[] lowHash = des.doFinal(magicConstant);
            des.init(Cipher.ENCRYPT_MODE, highKey);
            final byte[] highHash = des.doFinal(magicConstant);
            final byte[] lmHash = new byte[16];
            System.arraycopy(lowHash, 0, lmHash, 0, 8);
            System.arraycopy(highHash, 0, lmHash, 8, 8);
            return lmHash;
        } catch (final Exception e) {
            throw new NTLMEngineException(e.getMessage(), e);
        }
    }
Creates the LM Hash of the user's password.

@param password
           The password.

@return The LM Hash of the given password, used in the calculation of the
        LM Response.
httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/NTLMEngineImpl.java