mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 18:48:13 -07:00
ADD: @marshmellow42 's changes to "hf mfu *" ,
ADD: @marshmellow42 's changes to "hf mf sim", ADD: @pwpiwi 's parity files was missing.
This commit is contained in:
parent
f8ada309e9
commit
2b1f4228c2
8 changed files with 293 additions and 173 deletions
38
common/parity.h
Normal file
38
common/parity.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||
// the license.
|
||||
//-----------------------------------------------------------------------------
|
||||
// Generic CRC calculation code.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef __PARITY_H
|
||||
#define __PARITY_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern const uint8_t OddByteParity[256];
|
||||
|
||||
static inline uint8_t oddparity8(uint8_t bt)
|
||||
{
|
||||
return OddByteParity[bt];
|
||||
}
|
||||
|
||||
|
||||
extern const uint8_t EvenByteParity[256];
|
||||
|
||||
static inline uint8_t evenparity8(const uint8_t bt)
|
||||
{
|
||||
return EvenByteParity[bt];
|
||||
}
|
||||
|
||||
|
||||
static inline uint32_t evenparity32(uint32_t x)
|
||||
{
|
||||
x ^= x >> 16;
|
||||
x ^= x >> 8;
|
||||
return EvenByteParity[x & 0xff];
|
||||
}
|
||||
|
||||
|
||||
#endif /* __PARITY_H */
|
Loading…
Add table
Add a link
Reference in a new issue