Hi Daniel. Thanks for your question.

The spec for the odp_hash_crc32() API looks like this:

* Calculate CRC-32
* Calculates CRC-32 over the data. The polynomial is 0x04c11db7.
* @param data Pointer to data
* @param data_len Data length in bytes
* @param init_val CRC generator initialization value
* @return CRC32 value
uint32_t odp_hash_crc32(const void *data, uint32_t data_len, uint32_t init_val);

This performs a hash on whatever you point to and returns a 32-bit
value that is the CRC32 hash of those bytes. So it's up to you what
you want to hash. Is this an IP address stored as a 32-bit value
(e.g., in an IP header)? Then simply point to those four bytes. The
API neither knows nor cares what those bytes might represent. It's
simply performing a mathematical operation on them, meaning as long as
the same input bytes are given it will produce the same result value.

Happy New Year!

On Mon, Dec 31, 2018 at 1:19 PM Daniel Feferman <dlfefer...@gmail.com> wrote:
> Hi all,
> I'm new into ODP and this is probably a too simple question, but I want to
> make the CRC32 of an ipv4 source address (e.g.: using the
> function odp_hash_crc32(). However, I'm not quite sure what the data
> pointer should contain, is it:
> -
> -d3.61.31.d1
> -d36131d1
> -Any other option?
> Can someone help me with this question?
> Thanks,
> Daniel

Reply via email to