#define __STDC_FORMAT_MACROS
-#include <inttypes.h>
-#include "crapto1.h"
#include <stdio.h>
+#include <string.h>
#include <time.h>
-
-#define llx PRIx64
-#define lli PRIi64
+#include <inttypes.h>
+#include "crapto1.h"
int main (int argc, char *argv[]) {
struct Crypto1State *revstate;
for (int i = 0; i < encc; i++) {
enclen[i] = strlen(argv[i + 6]) / 2;
for (int i2 = 0; i2 < enclen[i]; i2++) {
- sscanf(argv[i+6] + i2*2,"%2x", (uint8_t*)&enc[i][i2]);
+ sscanf(argv[i+6] + i2*2, "%2x", (unsigned int *)&enc[i][i2]);
}
}
printf(" nt': %08x\n",prng_successor(nt, 64));
printf(" nt'': %08x\n",prng_successor(nt, 96));
- clock_t t1 = clock();
-
// Extract the keystream from the messages
printf("\nKeystream used to generate {ar} and {at}:\n");
ks2 = ar_enc ^ prng_successor(nt, 64);
lfsr_rollback_word(revstate, nr_enc, 1);
lfsr_rollback_word(revstate, uid ^ nt, 0);
crypto1_get_lfsr(revstate, &key);
- printf("\nFound Key: [%012"llx"]\n\n",key);
+ printf("\nFound Key: [%012" PRIx64 "]\n\n", key);
crypto1_destroy(revstate);
-
- t1 = clock() - t1;
- if ( t1 > 0 ) printf("Time : %.0f ticks \n", (float)t1);
return 0;
}