mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
32bit subghz hashes (less false duplicates)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user