mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-13 10:43:01 +08:00
added PSK2 to lf simpsk
testing still ongoing.
This commit is contained in:
parent
872e3d4d6f
commit
3bc66a96fe
3 changed files with 28 additions and 2 deletions
|
@ -28,6 +28,7 @@
|
|||
#include "cmdlft55xx.h"
|
||||
#include "cmdlfpcf7931.h"
|
||||
#include "cmdlfio.h"
|
||||
#include "lfdemod.h"
|
||||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
|
@ -853,13 +854,20 @@ int CmdLFpskSim(const char *Cmd)
|
|||
}
|
||||
if (dataLen == 0){ //using DemodBuffer
|
||||
if (clk==0) clk = GetPskClock(NULL, FALSE, FALSE);
|
||||
if (!carrier) carrier = GetPskCarrier(NULL, FALSE, FALSE);
|
||||
if (!carrier) carrier = GetPskCarrier(NULL, FALSE, FALSE);
|
||||
} else {
|
||||
setDemodBuf(data, dataLen, 0);
|
||||
}
|
||||
if (clk <= 0) clk = 32;
|
||||
if (carrier == 0) carrier = 2;
|
||||
|
||||
if (pskType != 1){
|
||||
if (pskType == 2){
|
||||
//need to convert psk2 to psk1 data before sim
|
||||
psk2TOpsk1(DemodBuffer, DemodBufferLen);
|
||||
} else {
|
||||
PrintAndLog("Sorry, PSK3 not yet available");
|
||||
}
|
||||
}
|
||||
uint16_t arg1, arg2;
|
||||
arg1 = clk << 8 | carrier;
|
||||
arg2 = invert;
|
||||
|
|
|
@ -1068,6 +1068,23 @@ void psk1TOpsk2(uint8_t *BitStream, size_t size)
|
|||
return;
|
||||
}
|
||||
|
||||
// by marshmellow
|
||||
// convert psk2 demod to psk1 demod
|
||||
// from only transition waves are 1s to phase shifts change bit
|
||||
void psk2TOpsk1(uint8_t *BitStream, size_t size)
|
||||
{
|
||||
size_t i;
|
||||
uint8_t phase=BitStream[0];
|
||||
//uint8_t lastBit=BitStream[0];
|
||||
for (i=1; i<size; i++){
|
||||
if (phase!=BitStream[i]){
|
||||
phase ^=1;
|
||||
}
|
||||
BitStream[i]=phase;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// redesigned by marshmellow adjusted from existing decode functions
|
||||
// indala id decoding - only tested on 26 bit tags, but attempted to make it work for more
|
||||
int indala26decode(uint8_t *bitStream, size_t *size, uint8_t *invert)
|
||||
|
|
|
@ -28,6 +28,7 @@ int fskdemod(uint8_t *dest, size_t size, uint8_t rfLen, uint8_t invert, uint8_t
|
|||
uint32_t bytebits_to_byte(uint8_t* src, size_t numbits);
|
||||
int nrzRawDemod(uint8_t *dest, size_t *size, int *clk, int *invert, int maxErr);
|
||||
void psk1TOpsk2(uint8_t *BitStream, size_t size);
|
||||
void psk2TOpsk1(uint8_t *BitStream, size_t size);
|
||||
int DetectNRZClock(uint8_t dest[], size_t size, int clock);
|
||||
int indala26decode(uint8_t *bitStream, size_t *size, uint8_t *invert);
|
||||
void pskCleanWave(uint8_t *bitStream, size_t size);
|
||||
|
|
Loading…
Reference in a new issue