mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-20 12:45:40 -05:00
Hashed DMR TG Multi Key Loading Fix; #112
This commit is contained in:
@@ -141,7 +141,7 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
|
|||||||
int x;
|
int x;
|
||||||
|
|
||||||
//24-bit TG to 16-bit hash
|
//24-bit TG to 16-bit hash
|
||||||
uint16_t hash = 0;
|
uint32_t hash = 0;
|
||||||
uint8_t hash_bits[24];
|
uint8_t hash_bits[24];
|
||||||
memset (hash_bits, 0, sizeof(hash_bits));
|
memset (hash_bits, 0, sizeof(hash_bits));
|
||||||
|
|
||||||
@@ -304,7 +304,8 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
|
|||||||
if (state->M == 0)
|
if (state->M == 0)
|
||||||
{
|
{
|
||||||
//see if we need to hash a value larger than 16-bits
|
//see if we need to hash a value larger than 16-bits
|
||||||
hash = state->lasttg & 0xFFFFFF;
|
hash = state->lasttg & 0xFFFFFF;
|
||||||
|
// fprintf (stderr, "TG: %lld Hash: %ld ", state->lasttg, hash);
|
||||||
if (hash > 0xFFFF) //if greater than 16-bits
|
if (hash > 0xFFFF) //if greater than 16-bits
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 24; i++)
|
for (int i = 0; i < 24; i++)
|
||||||
@@ -313,12 +314,14 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
|
|||||||
}
|
}
|
||||||
hash = ComputeCrcCCITT16d (hash_bits, 24);
|
hash = ComputeCrcCCITT16d (hash_bits, 24);
|
||||||
hash = hash & 0xFFFF; //make sure its no larger than 16-bits
|
hash = hash & 0xFFFF; //make sure its no larger than 16-bits
|
||||||
|
// fprintf (stderr, "Hash: %d ", hash);
|
||||||
}
|
}
|
||||||
if (state->rkey_array[hash] != 0)
|
if (state->rkey_array[hash] != 0)
|
||||||
{
|
{
|
||||||
state->K = state->rkey_array[hash] & 0xFF; //doesn't exceed 255
|
state->K = state->rkey_array[hash] & 0xFF; //doesn't exceed 255
|
||||||
state->K1 = state->H = state->rkey_array[hash] & 0xFFFFFFFFFF; //doesn't exceed 40-bit limit
|
state->K1 = state->H = state->rkey_array[hash] & 0xFFFFFFFFFF; //doesn't exceed 40-bit limit
|
||||||
opts->dmr_mute_encL = 0;
|
opts->dmr_mute_encL = 0;
|
||||||
|
// fprintf (stderr, "Key: %X ", state->rkey_array[hash]);
|
||||||
}
|
}
|
||||||
// else opts->dmr_mute_encL = 1; //may cause issues for manual key entry (non-csv)
|
// else opts->dmr_mute_encL = 1; //may cause issues for manual key entry (non-csv)
|
||||||
}
|
}
|
||||||
@@ -432,6 +435,7 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
|
|||||||
{
|
{
|
||||||
//see if we need to hash a value larger than 16-bits
|
//see if we need to hash a value larger than 16-bits
|
||||||
hash = state->lasttgR & 0xFFFFFF;
|
hash = state->lasttgR & 0xFFFFFF;
|
||||||
|
// fprintf (stderr, "TG: %lld Hash: %ld ", state->lasttgR, hash);
|
||||||
if (hash > 0xFFFF) //if greater than 16-bits
|
if (hash > 0xFFFF) //if greater than 16-bits
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 24; i++)
|
for (int i = 0; i < 24; i++)
|
||||||
@@ -440,12 +444,14 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
|
|||||||
}
|
}
|
||||||
hash = ComputeCrcCCITT16d (hash_bits, 24);
|
hash = ComputeCrcCCITT16d (hash_bits, 24);
|
||||||
hash = hash & 0xFFFF; //make sure its no larger than 16-bits
|
hash = hash & 0xFFFF; //make sure its no larger than 16-bits
|
||||||
|
// fprintf (stderr, "Hash: %d ", hash);
|
||||||
}
|
}
|
||||||
if (state->rkey_array[hash] != 0)
|
if (state->rkey_array[hash] != 0)
|
||||||
{
|
{
|
||||||
state->K = state->rkey_array[hash] & 0xFF; //doesn't exceed 255
|
state->K = state->rkey_array[hash] & 0xFF; //doesn't exceed 255
|
||||||
state->K1 = state->H = state->rkey_array[hash] & 0xFFFFFFFFFF; //doesn't exceed 40-bit limit
|
state->K1 = state->H = state->rkey_array[hash] & 0xFFFFFFFFFF; //doesn't exceed 40-bit limit
|
||||||
opts->dmr_mute_encR = 0;
|
opts->dmr_mute_encR = 0;
|
||||||
|
// fprintf (stderr, "Key: %X ", state->rkey_array[hash]);
|
||||||
}
|
}
|
||||||
// else opts->dmr_mute_encR = 1; //may cause issues for manual key entry (non-csv)
|
// else opts->dmr_mute_encR = 1; //may cause issues for manual key entry (non-csv)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user