mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-20 13:23:25 -07:00
a little cleanup
This commit is contained in:
parent
61500621bc
commit
4c6ccc2b04
3 changed files with 60 additions and 73 deletions
|
@ -170,6 +170,23 @@ uint8_t preambleSearch(uint8_t *BitStream, uint8_t *preamble, size_t pLen, size_
|
|||
return 0;
|
||||
}
|
||||
|
||||
// search for given preamble in given BitStream and return success=1 or fail=0 and startIndex (where it was found)
|
||||
// does not look for a repeating preamble
|
||||
// em4x05/4x69 only sends preamble once, so look for it once in the first pLen bits
|
||||
// leave it generic so it could be reused later...
|
||||
bool onePreambleSearch(uint8_t *BitStream, uint8_t *preamble, size_t pLen, size_t size, size_t *startIdx) {
|
||||
// Sanity check. If preamble length is bigger than bitstream length.
|
||||
if ( size <= pLen ) return false;
|
||||
for (size_t idx = 0; idx < size - pLen; idx++) {
|
||||
if (memcmp(BitStream+idx, preamble, pLen) == 0) {
|
||||
if (g_debugMode) prnt("DEBUG: preamble found at %u", idx);
|
||||
*startIdx = idx;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//by marshmellow
|
||||
//takes 1s and 0s and searches for EM410x format - output EM ID
|
||||
uint8_t Em410xDecode(uint8_t *BitStream, size_t *size, size_t *startIdx, uint32_t *hi, uint64_t *lo)
|
||||
|
|
|
@ -39,6 +39,7 @@ int manrawdecode(uint8_t *BitStream, size_t *size, uint8_t invert);
|
|||
int nrzRawDemod(uint8_t *dest, size_t *size, int *clk, int *invert);
|
||||
uint8_t parityTest(uint32_t bits, uint8_t bitLen, uint8_t pType);
|
||||
uint8_t preambleSearch(uint8_t *BitStream, uint8_t *preamble, size_t pLen, size_t *size, size_t *startIdx);
|
||||
bool onePreambleSearch(uint8_t *BitStream, uint8_t *preamble, size_t pLen, size_t size, size_t *startIdx);
|
||||
int pskRawDemod(uint8_t dest[], size_t *size, int *clock, int *invert);
|
||||
void psk2TOpsk1(uint8_t *BitStream, size_t size);
|
||||
void psk1TOpsk2(uint8_t *BitStream, size_t size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue