replace static countones & bitcount by utils in client

This commit is contained in:
Philippe Teuwen
2021-03-07 23:48:48 +01:00
parent e5c5629cf2
commit f2a0f3e272
3 changed files with 3 additions and 31 deletions

View File

@@ -103,14 +103,6 @@ static inline uint32_t leadingzeros(uint64_t a) {
#else
return 0;
#endif
}
static inline uint32_t countones(uint64_t a) {
#if defined __GNUC__
return __builtin_popcountll(a);
#else
return 0;
#endif
}
const char *card_types[] = {
@@ -2034,7 +2026,7 @@ static int CmdHFiClass_ReadBlock(const char *Cmd) {
uint64_t a = bytes_to_num(data, 8);
bool starts = (leadingzeros(a) < 12);
bool ones = (countones(a) > 16 && countones(a) < 48);
bool ones = (bitcount64(a) > 16 && bitcount64(a) < 48);
if (starts && ones) {
PrintAndLogEx(INFO, "data looks encrypted, False Positives " _YELLOW_("ARE") " possible");