Skip to content

Commit

Permalink
fine gcc, i'll inline this myself
Browse files Browse the repository at this point in the history
  • Loading branch information
ryancdotorg committed Nov 22, 2020
1 parent a6d52a4 commit ddea113
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 21 deletions.
37 changes: 29 additions & 8 deletions blfchk.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,36 @@ int main(int argc, char **argv) {
}

while (getline(&line, &line_sz, ifile) > 0) {
unhex(line, strlen(line), hash.uc, sizeof(hash.uc));
if (bloom_chk_hash160(bloom, hash.ul)) {
if (hfile && !hsearchf(hfile, &hash)) {
//fprintf(ofile, "%s (false positive)\n", hex(hash.uc, sizeof(hash.uc), buf, sizeof(buf)));
continue;
}
//fprintf(ofile, "%s\n", hex(hash.uc, sizeof(hash.uc), buf, sizeof(buf)));
fprintf(ofile, "%s", line);
unhex(line, strlen(line), hash.uc, sizeof(hash.uc));

unsigned int bit;
bit = BH00(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH01(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH02(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH03(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH04(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH05(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH06(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH07(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH08(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH09(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH10(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH11(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH12(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH13(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH14(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH15(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH16(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH17(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH18(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH19(hash.uc); if (BLOOM_GET_BIT(bit) == 0) { continue; }

if (hfile && !hsearchf(hfile, &hash)) {
//fprintf(ofile, "%s (false positive)\n", hex(hash.uc, sizeof(hash.uc), buf, sizeof(buf)));
continue;
}
//fprintf(ofile, "%s\n", hex(hash.uc, sizeof(hash.uc), buf, sizeof(buf)));
fprintf(ofile, "%s", line);
}

return 0;
Expand Down
2 changes: 1 addition & 1 deletion bloom.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#define BH19(N) (N[4]<<24|N[0]>> 8)

void bloom_set_hash160(unsigned char *, uint32_t *);
inline unsigned int bloom_chk_hash160(unsigned char *bloom, uint32_t *h) {
static unsigned int bloom_chk_hash160(unsigned char *bloom, uint32_t *h) {
unsigned int t;
t = BH00(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
t = BH01(h); if (BLOOM_GET_BIT(t) == 0) { return 0; }
Expand Down
44 changes: 32 additions & 12 deletions brainflayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,29 +765,49 @@ int main(int argc, char **argv) {

// loop over the public keys
for (i = 0; i < batch_stopped; ++i) {
j = 0;
if (bloom) { /* crack mode */
// loop over pubkey hash functions
while (pubhashfn[j].fn != NULL) {
for (j = 0; pubhashfn[j].fn != NULL; ++j) {
pubhashfn[j].fn(&hash160, batch_upub[i]);
if (bloom_chk_hash160(bloom, hash160.ul)) {
if (!fopt || hsearchf(ffile, &hash160)) {
if (tty) { fprintf(ofile, "\033[0K"); }
// reformat/populate the line if required
if (Iopt) {
hex(batch_priv[i], 32, batch_line[i], 65);
}
fprintresult(ofile, &hash160, pubhashfn[j].id, modestr, batch_line[i]);
++olines;

unsigned int bit;
bit = BH00(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH01(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH02(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH03(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH04(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH05(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH06(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH07(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH08(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH09(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH10(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH11(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH12(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH13(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH14(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH15(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH16(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH17(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH18(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }
bit = BH19(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; }

if (!fopt || hsearchf(ffile, &hash160)) {
if (tty) { fprintf(ofile, "\033[0K"); }
// reformat/populate the line if required
if (Iopt) {
hex(batch_priv[i], 32, batch_line[i], 65);
}
fprintresult(ofile, &hash160, pubhashfn[j].id, modestr, batch_line[i]);
++olines;
}
++j;
}
} else { /* generate mode */
// reformat/populate the line if required
if (Iopt) {
hex(batch_priv[i], 32, batch_line[i], 65);
}
j = 0;
while (pubhashfn[j].fn != NULL) {
pubhashfn[j].fn(&hash160, batch_upub[i]);
fprintresult(ofile, &hash160, pubhashfn[j].id, modestr, batch_line[i]);
Expand Down

0 comments on commit ddea113

Please sign in to comment.