32bit subghz hashes (less false duplicates)

This commit is contained in:
Willy-JL
2023-12-14 04:46:53 +00:00
parent c40755f700
commit 02ec1f0867
135 changed files with 258 additions and 203 deletions

View File

@@ -53,6 +53,21 @@ SubGhzProtocolStatus subghz_protocol_decoder_base_deserialize(
uint8_t subghz_protocol_decoder_base_get_hash_data(SubGhzProtocolDecoderBase* decoder_base) {
uint8_t hash = 0;
if(decoder_base->protocol && decoder_base->protocol->decoder &&
decoder_base->protocol->decoder->get_hash_data) {
uint32_t full = decoder_base->protocol->decoder->get_hash_data(decoder_base);
uint8_t* p = (uint8_t*)&full;
for(size_t i = 0; i < sizeof(full); i++) {
hash ^= p[i];
}
}
return hash;
}
uint32_t subghz_protocol_decoder_base_get_hash_data_long(SubGhzProtocolDecoderBase* decoder_base) {
uint32_t hash = 0;
if(decoder_base->protocol && decoder_base->protocol->decoder &&
decoder_base->protocol->decoder->get_hash_data) {
hash = decoder_base->protocol->decoder->get_hash_data(decoder_base);