public void updateChecksum(Memory memory, AddressSetView addrSet, TaskMonitor monitor,
			boolean onesComp, boolean twosComp) throws MemoryAccessException, CancelledException {
		int entry = 0;
		int[] ccitt_table = new int[256];
		for (int i = 0; i < 256; i++) {
			if (monitor.isCancelled()) {
				throw new CancelledException();
			}

			entry = i << 8;
			for (int j = 0; j < 8; j++) {
				if ((entry & 0x8000) > 0) {
					entry = (entry << 1) ^ 0x1021;
				}
				else {
					entry <<= 1;
				}
			}
			String value = Integer.toHexString(entry);
			if (value.length() > 4) {
				value = value.substring(value.length() - 4);
			}
			ccitt_table[i] = Integer.parseInt(value, 16);
		}
		long sum = 0xffff;
		MemoryByteIterator it = new MemoryByteIterator(memory, addrSet);
		while (it.hasNext()) {
			if (monitor.isCancelled()) {
				throw new CancelledException();
			}
			byte b = it.next();
			int value = 0;
			if (b < 0) {
				value = b + 256;
			}
			else {
				value = b;
			}
			int element = (int) ((sum >>> 8) & 0xff) ^ value;
			String loworder = Long.toHexString(sum);
			if (loworder.length() >= 2) {
				loworder = loworder.substring(loworder.length() - 2);
			}
			sum = ccitt_table[element] ^ (NumericUtilities.parseHexLong(loworder) << 8);
		}
		if (onesComp) {
			sum = ~sum;
		}
		else if (twosComp) {
			sum = -sum;
		}
		checksum = toArray(sum, 2);
	}
Computes the checksum with the given options.

@param memory The memory to generate the checksum from.
@param addrSet The addresses over which to generate the checksum.
@param monitor Cancelable task monitor to cancel the computation.
@param onesComp True if the checksum should be complemented with a ones complement.
@param twosComp True if the checksum should be complemented with a twos complement.
@throws MemoryAccessException If there was a problem reading the memory.
@throws CancelledException If the user cancels the task.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/checksums/CRC16CCITTChecksumAlgorithm.java