Template Function pn532::compute_checksum(std::uint8_t, ByteIterator, ByteIterator)

Function Documentation

template<class ByteIterator>
std::uint8_t pn532::compute_checksum(std::uint8_t sum_init, ByteIterator begin, ByteIterator end)

Incrementally computes the checksum of a sequence of bytes.

Template Parameters:

ByteIterator – Any forward iterator type that yields std::uint8_t.

Parameters:
  • sum_init – Initial value of the sum (for incremental computation).

  • begin – Iterator pointing to the first element.

  • end – Past-the-end iterator.

Returns:

The checksum, i.e. \( \text{sum_init}+1+\neg\sum_{i=\text{begin}}^{\text{end}} *i \)