mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 18:48:13 -07:00
text
Some checks failed
MacOS Build and Test / macos-make-btaddon (push) Has been cancelled
MacOS Build and Test / macos-cmake (push) Has been cancelled
Ubuntu Build and Test / ubuntu-make (push) Has been cancelled
Ubuntu Build and Test / ubuntu-make-btaddon (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
MacOS Build and Test / macos-make (push) Has been cancelled
Ubuntu Build and Test / ubuntu-cmake (push) Has been cancelled
Windows Build and Test / proxspace (push) Has been cancelled
Windows Build and Test / wsl (push) Has been cancelled
Some checks failed
MacOS Build and Test / macos-make-btaddon (push) Has been cancelled
MacOS Build and Test / macos-cmake (push) Has been cancelled
Ubuntu Build and Test / ubuntu-make (push) Has been cancelled
Ubuntu Build and Test / ubuntu-make-btaddon (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
MacOS Build and Test / macos-make (push) Has been cancelled
Ubuntu Build and Test / ubuntu-cmake (push) Has been cancelled
Windows Build and Test / proxspace (push) Has been cancelled
Windows Build and Test / wsl (push) Has been cancelled
This commit is contained in:
parent
488f7aa01e
commit
5de4dd68e5
15 changed files with 107 additions and 66 deletions
|
@ -450,6 +450,43 @@ void lslx(uint8_t *d, size_t n, uint8_t shifts) {
|
|||
}
|
||||
}
|
||||
|
||||
// right shift an array of length one bit
|
||||
void rsl(uint8_t *d, size_t n) {
|
||||
|
||||
uint8_t carry = 0;
|
||||
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
|
||||
// Save the LSB before shifting
|
||||
uint8_t new_carry = d[i] & 0x1;
|
||||
|
||||
// Shift current byte right and incorporate previous carry
|
||||
d[i] = (d[i] >> 1) | (carry ? 0x80 : 0);
|
||||
|
||||
// Update carry for next byte
|
||||
carry = new_carry;
|
||||
}
|
||||
}
|
||||
|
||||
void rslx(uint8_t *d, size_t n, uint8_t shifts) {
|
||||
|
||||
uint8_t carry = 0;
|
||||
for (uint8_t j = 0; j < shifts; j++) {
|
||||
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
|
||||
// Save the LSB before shifting
|
||||
uint8_t new_carry = d[i] & 0x1;
|
||||
|
||||
// Shift current byte right and incorporate previous carry
|
||||
d[i] = (d[i] >> 1) | (carry ? 0x80 : 0);
|
||||
|
||||
// Update carry for next byte
|
||||
carry = new_carry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// BSWAP24 of array[3]
|
||||
uint32_t le24toh(const uint8_t data[3]) {
|
||||
|
|
|
@ -135,6 +135,9 @@ void xor(uint8_t *dest, const uint8_t *src, size_t n);
|
|||
void lsl(uint8_t *d, size_t n);
|
||||
void lslx(uint8_t *d, size_t n, uint8_t shifts);
|
||||
|
||||
void rsl(uint8_t *d, size_t n);
|
||||
void rslx(uint8_t *d, size_t n, uint8_t shifts);
|
||||
|
||||
uint32_t le24toh(const uint8_t data[3]);
|
||||
void htole24(uint32_t val, uint8_t data[3]);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue