mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Stated making SLH algorithm
This commit is contained in:
@@ -81,4 +81,21 @@ inline uint64_t
|
||||
subghz_protocol_keeloq_common_magic_xor_type1_learning(uint32_t data, uint64_t xor) {
|
||||
data &= 0x0FFFFFFF;
|
||||
return (((uint64_t)data << 32) | data) ^ xor;
|
||||
}
|
||||
|
||||
/** Faac SLH (Spa) Learning
|
||||
* @param data - fix number (32bit)
|
||||
* @param seed - seed number (32bit)
|
||||
* @param key - mfkey (64bit)
|
||||
* @return man_learning for this fix number (64bit)
|
||||
*/
|
||||
|
||||
inline uint64_t
|
||||
subghz_protocol_keeloq_common_faac_learning(uint32_t data, uint32_t seed, const uint32_t key) {
|
||||
uint32_t k1, k2;
|
||||
uint16_t hs = seed >> 16;
|
||||
uint32_t lsb = (uint32_t)hs << 16 | 0x544D;
|
||||
k1 = subghz_protocol_keeloq_common_encrypt(seed, key);
|
||||
k2 = subghz_protocol_keeloq_common_encrypt(lsb, key);
|
||||
return ((uint64_t)k1 << 32) | k2;
|
||||
}
|
||||
Reference in New Issue
Block a user