checksum

group checksum

Compute and verify a 32-bit checksum of a byte buffer.

Functions

uint32_t cal_checksum(uint8_t *buffer, uint32_t size)

Calulates the checksum of a sized buffer.

Parameters
  • buffer – Pointer to the buffer

  • size – Size of the buffer

Returns

The 32-bit checksum of the buffer.

uint32_t calnstr_checksum(uint8_t *buffer, uint32_t size)

This function calulates the checksum of the buffer (Passed) of size (Passed), stores the checksum in the last 32byte address and returns the checksum.

Parameters
  • buffer – Pointer to the buffer.

  • size – Size of the buffer including the checksum word.

Returns

The checksum of the buffer passed.

bool verify_checksum(uint8_t *buffer, uint32_t size)

This function calculates the checksum of the buffer compares it to the last word and returns a Bool variable if both matches or not.

Parameters
  • buffer – Pointer to the buffer.

  • size – Size of the buffer including the checksum word.

Returns

1 for checksum matched and 0 for checksum mismatch