mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-25 22:32:29 +03:00
Update nice_flor_s.c
This commit is contained in:
parent
25ce89e39d
commit
0b496f70c2
@ -128,13 +128,17 @@ static bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
instance->generic.cnt++;
|
instance->generic.cnt++;
|
||||||
FURI_LOG_I(TAG, "serial = %07lX", instance->generic.serial);
|
FURI_LOG_I(TAG, "serial = %7X", instance->generic.serial);
|
||||||
FURI_LOG_I(TAG, "counter = %04lX", instance->generic.cnt);
|
FURI_LOG_I(TAG, "counter = %4X", instance->generic.cnt);
|
||||||
FURI_LOG_I(TAG, "button = %01lX", btn);
|
FURI_LOG_I(TAG, "button = %1X", btn);
|
||||||
uint64_t decrypt = ((uint64_t)instance->generic.serial << 16) | instance->generic.cnt;
|
uint64_t decrypt = ((uint64_t)instance->generic.serial << 16) | instance->generic.cnt;
|
||||||
FURI_LOG_I(TAG, "decrypt = %011lX", (uint64_t)decrypt);
|
uint32_t hi = decrypt >> 32;
|
||||||
|
uint32_t lo = decrypt & 0xFFFFFFFF;
|
||||||
|
FURI_LOG_I(TAG, "decrypt = %3X%8X", hi, lo);
|
||||||
uint64_t enc_part = subghz_protocol_nice_flor_s_encrypt(decrypt, file_name);
|
uint64_t enc_part = subghz_protocol_nice_flor_s_encrypt(decrypt, file_name);
|
||||||
FURI_LOG_I(TAG, "enc_part = %011lX", (uint64_t)enc_part);
|
hi = enc_part >> 32;
|
||||||
|
lo = enc_part & 0xFFFFFFFF;
|
||||||
|
FURI_LOG_I(TAG, "enc_part = %3X%8X", hi, lo);
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
|
|
||||||
@ -153,24 +157,31 @@ static bool
|
|||||||
0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0, 0xF, 0xE, 0xD, 0xC, 0xB, 0xA, 0x9, 0x8 }
|
0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0, 0xF, 0xE, 0xD, 0xC, 0xB, 0xA, 0x9, 0x8 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
uint8_t byte;
|
||||||
|
|
||||||
if (btn == 0x1) {
|
if (btn == 0x1) {
|
||||||
//Button 1
|
//Button 1
|
||||||
instance->generic.data = ((uint64_t)btn << 4) | (0xF ^ btn ^ loops[0][i]) << 44 | enc_part;
|
byte = btn << 4 | (0xF ^ btn ^ loops[0][i]);
|
||||||
|
instance->generic.data = (uint64_t)byte << 44 | enc_part;
|
||||||
}
|
}
|
||||||
if (btn == 0x2) {
|
if (btn == 0x2) {
|
||||||
//Button 2
|
//Button 2
|
||||||
instance->generic.data = ((uint64_t)btn << 4) | (0xF ^ btn ^ loops[1][i]) << 44 | enc_part;
|
byte = btn << 4 | (0xF ^ btn ^ loops[1][i]);
|
||||||
|
instance->generic.data = (uint64_t)byte << 44 | enc_part;
|
||||||
}
|
}
|
||||||
if (btn == 0x4) {
|
if (btn == 0x4) {
|
||||||
//Button 3
|
//Button 3
|
||||||
instance->generic.data = ((uint64_t)btn << 4) | (0xF ^ btn ^ loops[2][i]) << 44 | enc_part;
|
byte = btn << 4 | (0xF ^ btn ^ loops[2][i]);
|
||||||
|
instance->generic.data = (uint64_t)byte << 44 | enc_part;
|
||||||
}
|
}
|
||||||
if (btn == 0x8) {
|
if (btn == 0x8) {
|
||||||
//Button 4
|
//Button 4
|
||||||
instance->generic.data = ((uint64_t)btn << 4) | (0xF ^ btn ^ loops[3][i]) << 44 | enc_part;
|
byte = btn << 4 | (0xF ^ btn ^ loops[3][i]);
|
||||||
|
instance->generic.data = (uint64_t)byte << 44 | enc_part;
|
||||||
}
|
}
|
||||||
FURI_LOG_I(TAG, "key = %013lX", (uint64_t)instance->generic.data);
|
hi = instance->generic.data >> 32;
|
||||||
|
lo = instance->generic.data & 0xFFFFFFFF;
|
||||||
|
FURI_LOG_I(TAG, "key = %5X%8X", hi, lo);
|
||||||
|
|
||||||
//Send header
|
//Send header
|
||||||
for(uint8_t i = 35; i > 0; i--) {
|
for(uint8_t i = 35; i > 0; i--) {
|
||||||
@ -323,7 +334,9 @@ uint64_t subghz_protocol_nice_flor_s_encrypt(uint64_t data, const char* file_nam
|
|||||||
k = ~p[3];
|
k = ~p[3];
|
||||||
p[3] = ~p[1];
|
p[3] = ~p[1];
|
||||||
p[1] = k;
|
p[1] = k;
|
||||||
FURI_LOG_I(TAG, "encrypted_data = %011lX", (uint64_t)data);
|
uint32_t hi = data >> 32;
|
||||||
|
uint32_t lo = data & 0xFFFFFFFF;
|
||||||
|
FURI_LOG_I(TAG, "encrypted_data = %3X%8X", hi, lo);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,7 +375,9 @@ static uint64_t
|
|||||||
p[1] = k;
|
p[1] = k;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FURI_LOG_I(TAG, "decrypted_data = %011lX", (uint64_t)data);
|
uint32_t hi = data >> 32;
|
||||||
|
uint32_t lo = data & 0xFFFFFFFF;
|
||||||
|
FURI_LOG_I(TAG, "decrypted_data = %5X%8X", hi, lo);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,7 +522,9 @@ static void subghz_protocol_nice_flor_s_remote_controller(
|
|||||||
instance->btn = 0;
|
instance->btn = 0;
|
||||||
} else {
|
} else {
|
||||||
uint64_t decrypt = subghz_protocol_nice_flor_s_decrypt(instance, file_name);
|
uint64_t decrypt = subghz_protocol_nice_flor_s_decrypt(instance, file_name);
|
||||||
FURI_LOG_I(TAG, "init_decrypted_data = %013lX", (uint64_t)decrypt);
|
uint32_t hi = decrypt >> 32;
|
||||||
|
uint32_t lo = decrypt & 0xFFFFFFFF;
|
||||||
|
FURI_LOG_I(TAG, "init_decrypted_data = %5X%8X", hi, lo);
|
||||||
instance->cnt = decrypt & 0xFFFF;
|
instance->cnt = decrypt & 0xFFFF;
|
||||||
instance->serial = (decrypt >> 16) & 0xFFFFFFF;
|
instance->serial = (decrypt >> 16) & 0xFFFFFFF;
|
||||||
instance->btn = (decrypt >> 48) & 0xF;
|
instance->btn = (decrypt >> 48) & 0xF;
|
||||||
|
Loading…
Reference in New Issue
Block a user