lf t55xx dangerraw - now uses cliparser

This commit is contained in:
iceman1001
2021-02-05 16:37:08 +01:00
parent 6bcf31e68c
commit 1c576d10c8
3 changed files with 56 additions and 63 deletions

View File

@@ -806,13 +806,29 @@ int binarraytohex(char *target, const size_t targetlen, char *source, size_t src
// convert binary array to human readable binary
void binarraytobinstring(char *target, char *source, int length) {
int i;
for (i = 0 ; i < length ; ++i)
for (int i = 0 ; i < length; ++i)
*(target++) = *(source++) + '0';
*target = '\0';
}
int binstring2binarray(uint8_t* target, char *source, int length) {
int count = 0;
char *start = source;
while (length--) {
char x = *(source++);
// convert from binary value
if (x >= '0' && x <= '1')
x -= '0';
else {
PrintAndLogEx(WARNING, "(binstring2binarray) discovered unknown character %c %d at idx %d of %s", x, x, (int16_t)(source - start), start);
return 0;
}
*(target++) = x;
count++;
}
return count;
}
// return parity bit required to match type
uint8_t GetParity(uint8_t *bits, uint8_t type, int length) {
int x;