From c65e3a26fc7c4247936f4d536776445205be1873 Mon Sep 17 00:00:00 2001 From: owein D Date: Tue, 29 Sep 2020 21:01:13 +0200 Subject: [PATCH] update efficient rain option --- bfg.c | 44 +++++++++++++++----------------------------- bfg.h | 3 --- 2 files changed, 15 insertions(+), 32 deletions(-) diff --git a/bfg.c b/bfg.c index a3a6d68..a06a93a 100644 --- a/bfg.c +++ b/bfg.c @@ -60,7 +60,6 @@ static int32_t add_single_char(char ch, char flags, int32_t *crs_len) { // int32_t bf_init(char *arg) { bf_options.rotate = 0; - bf_options.strafe = 0; int32_t i = 0; int32_t crs_len = 0; @@ -224,34 +223,16 @@ char *bf_next(_Bool rainy) { if(rainy) { - //only strafe the index above length 3 - if(bf_options.current > 3) { - for(i=0; i= 0 && (++bf_options.state[bf_options.current-1-pos]) >= bf_options.crs_len) { + bf_options.state[bf_options.current-1-pos] = 0; + pos--; + } + else while (pos >= 0 && (++bf_options.state[pos]) >= bf_options.crs_len) { bf_options.state[pos] = 0; pos--; - bf_options.strafe = 0; - bf_options.rotate = 0; } if (pos < 0) { diff --git a/bfg.h b/bfg.h index 38bbbc2..3ff0710 100644 --- a/bfg.h +++ b/bfg.h @@ -43,10 +43,7 @@ typedef struct { char *crs; /* internal representation of charset */ char *ptr; /* ptr to the last generated password */ uint32_t disable_symbols; - uint64_t rotate; - uint64_t strafe; - } bf_option; extern bf_option bf_options;