1 /*
2  * Copyright (c) 2018 Google LLC.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/sys/crc.h>
8 
crc7_be(uint8_t seed,const uint8_t * src,size_t len)9 uint8_t crc7_be(uint8_t seed, const uint8_t *src, size_t len)
10 {
11 	while (len--) {
12 		uint8_t e = seed ^ *src++;
13 		uint8_t f = e ^ (e >> 4) ^ (e >> 7);
14 
15 		seed = (f << 1) ^ (f << 4);
16 	}
17 
18 	return seed;
19 }
20