Refactor KeeLoq crypto functions and add new KeeLoq TX app (#2990)

This commit is contained in:
lifegame1lu111
2026-02-16 14:19:50 +00:00
committed by GitHub
parent 00f40bf171
commit 83a4580353
14 changed files with 545 additions and 37 deletions
+5 -2
View File
@@ -43,7 +43,7 @@ bool read_keeloq_file(const fs::path& path, KeeloqData& data) {
data.mf_name = std::string{chunks[0]};
data.serial = std::strtoul(chunks[1].data(), NULL, 16);
data.counter = std::atoi(chunks[2].data());
data.counter = (uint16_t)std::atoi(chunks[2].data());
data.btn = (uint8_t)std::atoi(chunks[3].data());
return true;
@@ -60,7 +60,10 @@ bool write_keeloq_file(const fs::path& path, const KeeloqData& data) {
return false;
}
std::string formatted = data.mf_name + ";" + to_string_hex(data.serial) + ";" + to_string_dec_uint(data.counter) + ";" + to_string_dec_uint(data.btn);
std::string formatted = data.mf_name + ";" +
to_string_hex(data.serial) + ";" +
to_string_dec_uint(data.counter) + ";" +
to_string_dec_uint(data.btn);
file.write_line(formatted);
file.close();