mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
hardnested: get rid of shift by negative value
This commit is contained in:
parent
87660df8f2
commit
258332894b
2 changed files with 5 additions and 3 deletions
|
@ -367,9 +367,10 @@ static uint16_t PartialSumProperty(uint32_t state, odd_even_t odd_even) {
|
||||||
uint32_t st = state;
|
uint32_t st = state;
|
||||||
uint16_t part_sum = 0;
|
uint16_t part_sum = 0;
|
||||||
if (odd_even == ODD_STATE) {
|
if (odd_even == ODD_STATE) {
|
||||||
for (uint16_t i = 0; i < 5; i++) {
|
part_sum ^= filter(st);
|
||||||
part_sum ^= filter(st);
|
for (uint16_t i = 0; i < 4; i++) {
|
||||||
st = (st << 1) | ((j >> (3 - i)) & 0x01) ;
|
st = (st << 1) | ((j >> (3 - i)) & 0x01) ;
|
||||||
|
part_sum ^= filter(st);
|
||||||
}
|
}
|
||||||
part_sum ^= 1; // XOR 1 cancelled out for the other 8 bits
|
part_sum ^= 1; // XOR 1 cancelled out for the other 8 bits
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -44,9 +44,10 @@ static uint16_t PartialSumProperty(uint32_t state, odd_even_t odd_even) {
|
||||||
uint32_t st = state;
|
uint32_t st = state;
|
||||||
uint16_t part_sum = 0;
|
uint16_t part_sum = 0;
|
||||||
if (odd_even == ODD_STATE) {
|
if (odd_even == ODD_STATE) {
|
||||||
|
part_sum ^= filter(st);
|
||||||
for (uint16_t i = 0; i < 4; i++) {
|
for (uint16_t i = 0; i < 4; i++) {
|
||||||
part_sum ^= filter(st);
|
|
||||||
st = (st << 1) | ((j >> (3 - i)) & 0x01) ;
|
st = (st << 1) | ((j >> (3 - i)) & 0x01) ;
|
||||||
|
part_sum ^= filter(st);
|
||||||
}
|
}
|
||||||
part_sum ^= 1; // XOR 1 cancelled out for the other 8 bits
|
part_sum ^= 1; // XOR 1 cancelled out for the other 8 bits
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue