time is 64b better to accept the same size input timestamps

This commit is contained in:
iceman1001 2023-02-21 04:40:48 +01:00
commit 49a475899a
3 changed files with 9 additions and 4 deletions

View file

@ -111,7 +111,8 @@ int main(int argc, char *argv[]) {
uint8_t tag_challenge[16] = {0x00};
uint8_t lock_challenge[32] = {0x00};
uint64_t timestamp = atoi(argv[1]);
uint64_t timestamp = 0;
sscanf(argv[1], "%lu", &timestamp);
if (argc != 4) {
printf("\nusage: %s <unix timestamp> <16 byte tag challenge> <32 byte lock challenge>\n\n", argv[0]);
@ -124,8 +125,10 @@ int main(int argc, char *argv[]) {
if (hexstr_to_byte_array(argv[3], lock_challenge, sizeof(lock_challenge)))
return 3;
// current time
uint64_t start_time = time(NULL);
// from a time before up until current time.
for (; timestamp < start_time; timestamp++) {
make_key(timestamp, key);