diff --git a/fw/hash.c b/fw/hash.c index e962f0c..b876598 100644 --- a/fw/hash.c +++ b/fw/hash.c @@ -15,6 +15,8 @@ #include #include +#include + #include "hash.h" @@ -39,6 +41,19 @@ void hash_merge(const uint8_t *buf, uint8_t len) } +#ifdef __AVR__ + +void hash_merge_progmem(const uint8_t *buf, uint8_t len) +{ + uint8_t i; + + for (i = 0; i != len; i++) + hash[i & (HASH_SIZE-1)] ^= pgm_read_byte(buf+i); +} + +#endif /* __AVR__ */ + + void hash_end(void) { } diff --git a/fw/hash.h b/fw/hash.h index 253b9db..bd20695 100644 --- a/fw/hash.h +++ b/fw/hash.h @@ -19,6 +19,7 @@ void hash_init(void); void hash_merge(const uint8_t *buf, uint8_t len); +void hash_merge_progmem(const uint8_t *buf, uint8_t len); void hash_end(void); bool hash_eq(const uint8_t *buf, uint8_t len, uint8_t off); void hash_cp(uint8_t *buf, uint8_t len, uint8_t off);