From fb48d8ee1bc019fd343e4508b5cc888d0f034117 Mon Sep 17 00:00:00 2001 From: Siddharth Purohit Date: Sun, 6 Oct 2019 11:06:19 +0530 Subject: [PATCH] AP_Math: add method for generating hash --- libraries/AP_Math/crc.cpp | 11 +++++++++++ libraries/AP_Math/crc.h | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/libraries/AP_Math/crc.cpp b/libraries/AP_Math/crc.cpp index a53540de61..7c5a017c50 100644 --- a/libraries/AP_Math/crc.cpp +++ b/libraries/AP_Math/crc.cpp @@ -255,3 +255,14 @@ uint16_t calc_crc_modbus(uint8_t *buf, uint16_t len) } return crc; } + +// FNV-1a implementation +#define FNV_1_PRIME_64 1099511628211UL +void hash_fnv_1a(uint32_t len, const uint8_t* buf, uint64_t* hash) +{ + uint32_t i; + for (i=0; i