Some small fixes

This commit is contained in:
unkernet
2017-08-27 23:32:34 +03:00
parent f028c5e4e3
commit e6b23bd0e2
3 changed files with 13 additions and 4 deletions

View File

@ -517,6 +517,7 @@ void * update_predictions_thread(void* p){
if(space){
total_states = craptev1_sizeof_space(space);
}
sleep(1); // We don't need to check this more often than once per second
}
return NULL;
}

View File

@ -8,6 +8,7 @@
#include "crypto1_bs.h"
#include "crypto1_bs_crack.h"
#include <inttypes.h>
#include <math.h>
#define __STDC_FORMAT_MACROS
#define llx PRIx64
#define lli PRIi64
@ -16,7 +17,7 @@
#define VT100_cleareol "\r\33[2K"
uint32_t **space;
size_t thread_count = 1;
uint8_t thread_count = 1;
uint64_t *readnonces(char* fname) {
int i, j;
@ -120,7 +121,7 @@ int main(int argc, char* argv[]){
total_states_tested = 0;
keys_found = 0;
printf("Starting %zu threads to test %"llu" states\n", thread_count, total_states);
printf("Starting %u threads to test %"llu" (~2^%0.2f) states\n", thread_count, total_states, log(total_states) / log(2));
signal(SIGALRM, notify_status_offline);
alarm(1);
@ -134,7 +135,9 @@ int main(int argc, char* argv[]){
alarm(0);
printf("Tested %"llu" states\n", total_states_tested);
printf("\nTested %"llu" states\n", total_states_tested);
if(!keys_found) fprintf(stderr, "No solution found :(\n");
craptev1_destroy_space(space);
return 0;

View File

@ -8,6 +8,7 @@
#include "crypto1_bs.h"
#include "crypto1_bs_crack.h"
#include <inttypes.h>
#include <math.h>
#define __STDC_FORMAT_MACROS
#define llx PRIx64
#define lli PRIi64
@ -23,6 +24,10 @@ uint32_t uid;
uint64_t *readnonces(char* fname){
int i;
FILE *f = fopen(fname, "rb");
if (f == NULL) {
fprintf(stderr, "Cannot open file.\n");
exit(EXIT_FAILURE);
}
uint64_t *nonces = malloc(sizeof (uint64_t) << 24);
if(fread(&uid, 1, 4, f)){
uid = rev32(uid);
@ -119,7 +124,7 @@ int main(int argc, char* argv[]){
total_states_tested = 0;
keys_found = 0;
printf("Starting %u threads to test %"llu" states\n", thread_count, total_states);
printf("Starting %u threads to test %"llu" (~2^%0.2f) states\n", thread_count, total_states, log(total_states) / log(2));
signal(SIGALRM, notify_status_offline);
alarm(1);