CHG: some textual change to README.txt
ADD: a prng.c to collect some different PRNG's i've ran into ADD: some changes the tea implementation ADD: a enhanced version - SwapEndian64ex
This commit is contained in:
@@ -142,7 +142,7 @@ CMDSRCS = nonce2key/crapto1.c\
|
||||
reveng/poly.c\
|
||||
reveng/getopt.c\
|
||||
tea.c\
|
||||
|
||||
prng.c
|
||||
|
||||
ZLIBSRCS = deflate.c adler32.c trees.c zutil.c inflate.c inffast.c inftrees.c
|
||||
ZLIB_FLAGS = -DZ_SOLO -DZ_PREFIX -DNO_GZIP -DZLIB_PM3_TUNED
|
||||
|
||||
@@ -2325,21 +2325,15 @@ int Cmdbin2hex(const char *Cmd)
|
||||
}
|
||||
|
||||
int usage_data_hex2bin(){
|
||||
|
||||
PrintAndLog("Usage: data bin2hex <binary_digits>");
|
||||
PrintAndLog("Usage: data hex2bin <hex_digits>");
|
||||
PrintAndLog(" This function will ignore all non-hexadecimal characters (but stop reading on whitespace)");
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int Cmdhex2bin(const char *Cmd)
|
||||
{
|
||||
int bg =0, en =0;
|
||||
if(param_getptr(Cmd, &bg, &en, 0))
|
||||
{
|
||||
return usage_data_hex2bin();
|
||||
}
|
||||
|
||||
if(param_getptr(Cmd, &bg, &en, 0)) return usage_data_hex2bin();
|
||||
|
||||
while(bg <= en )
|
||||
{
|
||||
|
||||
@@ -194,7 +194,7 @@ void num_to_bytebits(uint64_t n, size_t len, uint8_t *dest) {
|
||||
// hh,gg,ff,ee,dd,cc,bb,aa, pp,oo,nn,mm,ll,kk,jj,ii
|
||||
// up to 64 bytes or 512 bits
|
||||
uint8_t *SwapEndian64(const uint8_t *src, const size_t len, const uint8_t blockSize){
|
||||
static uint8_t buf[64];
|
||||
uint8_t buf[64];
|
||||
memset(buf, 0x00, 64);
|
||||
uint8_t *tmp = buf;
|
||||
for (uint8_t block=0; block < (uint8_t)(len/blockSize); block++){
|
||||
@@ -205,6 +205,15 @@ uint8_t *SwapEndian64(const uint8_t *src, const size_t len, const uint8_t blockS
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void SwapEndian64ex(const uint8_t *src, const size_t len, const uint8_t blockSize, uint8_t *dest){
|
||||
for (uint8_t block=0; block < (uint8_t)(len/blockSize); block++){
|
||||
for (size_t i = 0; i < blockSize; i++){
|
||||
dest[i+(blockSize*block)] = src[(blockSize-1-i)+(blockSize*block)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// string parameters lib
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@@ -46,6 +46,7 @@ void num_to_bytes(uint64_t n, size_t len, uint8_t* dest);
|
||||
uint64_t bytes_to_num(uint8_t* src, size_t len);
|
||||
void num_to_bytebits(uint64_t n, size_t len, uint8_t *dest);
|
||||
uint8_t *SwapEndian64(const uint8_t *src, const size_t len, const uint8_t blockSize);
|
||||
void SwapEndian64ex(const uint8_t *src, const size_t len, const uint8_t blockSize, uint8_t *dest);
|
||||
|
||||
char param_getchar(const char *line, int paramnum);
|
||||
int param_getptr(const char *line, int *bg, int *en, int paramnum);
|
||||
|
||||
Reference in New Issue
Block a user