driver-core/src/main/com/mongodb/internal/HexUtils.java
public static String hexMD5(final ByteBuffer buf, final int offset, final int len) {
        byte[] b = new byte[len];
        for (int i = 0; i < len; i++) {
            b[i] = buf.get(offset + i);
        }

        return hexMD5(b);
    }
public static String hexMD5(final ByteBuffer buf, final int offset, final int len) {
        byte[] b = new byte[len];
        for (int i = 0; i < len; i++) {
            b[i] = buf.get(offset + i);
        }

        return hexMD5(b);
    }
Produce hex representation of the MD5 digest of a byte array.

@param buf    byte buffer containing the bytes to digest
@param offset the position to start reading bytes from
@param len    the number of bytes to read from the buffer
@return hex string of the MD5 digest