diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 4b75e7b..4b3a33d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -10,12 +10,10 @@ jobs: Pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v1 + - uses: actions/checkout@v3 + - uses: actions/cache@v3 with: path: ~/.cache/pre-commit key: pre-commit|${{ hashFiles('.pre-commit-config.yaml') }} - - uses: actions/setup-python@v2 - with: - python-version: 3.9.10 - - uses: pre-commit/action@v2.0.3 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.0 diff --git a/.gitmodules b/.gitmodules index 15f84b1..4a638d1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "secp256k1"] - path = secp256k1 - url = https://github.com/ryancdotorg/secp256k1.git + path = secp256k1 + url = https://github.com/bitcoin-core/secp256k1.git [submodule "scrypt-jane"] path = scrypt-jane url = https://github.com/ryancdotorg/scrypt-jane.git diff --git a/2.py b/2.py deleted file mode 100644 index 28ff344..0000000 --- a/2.py +++ /dev/null @@ -1,14 +0,0 @@ -import line - -ids = {} -found = [] -with open("wordlist.txt") as file1: - for line in file1.lines(): - id_ = line.split()[0] - ids[id_] = line - -with open("base") as file2: - for line in file2.lines(): - id_ = line.split()[0] - if id_ in ids: - found.append("{} {}".format(ids[id_], line)) diff --git a/Makefile b/Makefile index 5b2907b..28e8185 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ algo/brainwalletio.o: algo/brainwalletio.c scrypt-jane/scrypt-jane.h algo/brainv2.o: algo/brainv2.c scrypt-jane/scrypt-jane.h ec_pubkey_fast.o: ec_pubkey_fast.c secp256k1/include/secp256k1.h - $(COMPILE) -Wno-unused-function -c $< -o $@ + $(COMPILE) -Wno-unused-function -c $< -o $@ -I secp256k1 %.o: %.c $(COMPILE) -c $< -o $@ diff --git a/README.md b/README.md index 15289fb..da095b6 100644 --- a/README.md +++ b/README.md @@ -172,11 +172,11 @@ installed (at least openssl and gmp are required along with libsecp256k1's build dependencies). I really need to learn autotools. If you file an issue about a build failure in libsecp256k1 I will close it. -Dependencies should install with +Dependencies should install with: ``` -apt install autoconf autogen git libtool make -apt install build-essential libgmp-dev libgmp3-dev libssl-dev +apt install autoconf autogen automake git libtool make +apt install build-essential libgmp-dev libgmp3-dev libssl-dev zlib1g-dev ``` Supported build target is currently Ubuntu 20.04 on amd64/x86_64. Issues with diff --git a/blfchk.c b/blfchk.c index 3a97bc6..72a980d 100644 --- a/blfchk.c +++ b/blfchk.c @@ -77,6 +77,11 @@ int main(int argc, char **argv) { bit = BH17(hash.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; } bit = BH18(hash.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; } bit = BH19(hash.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; } + bit = BH20(hash.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; } + bit = BH21(hash.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; } + bit = BH22(hash.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; } + bit = BH23(hash.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; } + bit = BH24(hash.ul); 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))); diff --git a/bloom.c b/bloom.c index 7d863a9..f9668cc 100644 --- a/bloom.c +++ b/bloom.c @@ -34,6 +34,11 @@ void bloom_set_hash160(unsigned char *bloom, uint32_t *h) { t = BH17(h); BLOOM_SET_BIT(t); t = BH18(h); BLOOM_SET_BIT(t); t = BH19(h); BLOOM_SET_BIT(t); + t = BH20(h); BLOOM_SET_BIT(t); + t = BH21(h); BLOOM_SET_BIT(t); + t = BH22(h); BLOOM_SET_BIT(t); + t = BH23(h); BLOOM_SET_BIT(t); + t = BH24(h); BLOOM_SET_BIT(t); } /* diff --git a/bloom.h b/bloom.h index 4f2368a..de3dce9 100644 --- a/bloom.h +++ b/bloom.h @@ -5,7 +5,7 @@ #include /* 2^32 bits */ -#define BLOOM_SIZE (512*1024*1024) +#define BLOOM_SIZE (512*1024*1024*2) #define BLOOM_SET_BIT(N) (bloom[(N)>>3] = bloom[(N)>>3] | (1<<((N)&7))) #define BLOOM_GET_BIT(N) ( ( bloom[(N)>>3]>>((N)&7) )&1) @@ -33,6 +33,17 @@ #define BH17(N) (N[2]<<24|N[3]>> 8) #define BH18(N) (N[3]<<24|N[4]>> 8) #define BH19(N) (N[4]<<24|N[0]>> 8) +#define BH20(N) (N[0]<<16|N[1]>>24) +#define BH21(N) (N[1]<<16|N[2]>>24) +#define BH22(N) (N[2]<<16|N[3]>>24) +#define BH23(N) (N[3]<<16|N[4]>>24) +#define BH24(N) (N[4]<<16|N[0]>>24) + +#define BH20(N) (N[0]<<16|N[1]>>24) +#define BH21(N) (N[1]<<16|N[2]>>24) +#define BH22(N) (N[2]<<16|N[3]>>24) +#define BH23(N) (N[3]<<16|N[4]>>24) +#define BH24(N) (N[4]<<16|N[0]>>24) void bloom_set_hash160(unsigned char *, uint32_t *); #pragma GCC diagnostic ignored "-Wunused-function" @@ -58,6 +69,11 @@ static unsigned int bloom_chk_hash160(unsigned char *bloom, uint32_t *h) { t = BH17(h); if (BLOOM_GET_BIT(t) == 0) { return 0; } t = BH18(h); if (BLOOM_GET_BIT(t) == 0) { return 0; } t = BH19(h); if (BLOOM_GET_BIT(t) == 0) { return 0; } + t = BH20(h); if (BLOOM_GET_BIT(t) == 0) { return 0; } + t = BH21(h); if (BLOOM_GET_BIT(t) == 0) { return 0; } + t = BH22(h); if (BLOOM_GET_BIT(t) == 0) { return 0; } + t = BH23(h); if (BLOOM_GET_BIT(t) == 0) { return 0; } + t = BH24(h); if (BLOOM_GET_BIT(t) == 0) { return 0; } return 1; } #pragma GCC diagnostic pop diff --git a/brainflayer.c b/brainflayer.c index 38a6ef9..985802d 100644 --- a/brainflayer.c +++ b/brainflayer.c @@ -2,8 +2,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -33,7 +33,10 @@ #include "algo/sha3.h" // raise this if you really want, but quickly diminishing returns -#define BATCH_MAX 4096 +#define BATCH_MAX 4096*14 + +// Number of supported bloom files. +#define BOPT_MAX 10 static int brainflayer_is_init = 0; @@ -44,8 +47,8 @@ typedef struct pubhashfn_s { static unsigned char *mem; -static mmapf_ctx bloom_mmapf; -static unsigned char *bloom = NULL; +static mmapf_ctx bloom_mmapf[10]; +static unsigned char *bloom, *blooms[10]; static unsigned char *unhexed = NULL; static size_t unhexed_sz = 4096; @@ -348,6 +351,7 @@ void usage(unsigned char *name) { printf("Usage: %s [OPTION]...\n\n\ -a open output file in append mode\n\ -b FILE check for matches against bloom filter FILE\n\ + multiple files be be specified\n\ -f FILE verify matches against sorted hash160s in FILE\n\ -i FILE read from FILE instead of stdin\n\ -o FILE write to FILE instead of stdout\n\ @@ -359,6 +363,9 @@ void usage(unsigned char *name) { c - compressed address\n\ e - ethereum address\n\ x - most signifigant bits of x coordinate\n\ + -C keep original control characters\n\ + by default \\r and \\n are removed\n\ + (option is ignored in hex mode)\n\ -t TYPE inputs are TYPE - supported types:\n\ sha256 (default) - classic brainwallet\n\ sha3 - sha3-256\n\ @@ -369,7 +376,7 @@ void usage(unsigned char *name) { rush - rushwallet (requires -r) FAST\n\ keccak - keccak256 (ethercamp/old ethaddress)\n\ camp2 - keccak256 * 2031 (new ethercamp)\n\ - shaxn - N rounds of SHA-256\n\ + shaxn - N rounds of SHA-256\n\ -x treat input as hex encoded\n\ -s SALT use SALT for salted input types (default: none)\n\ -p PASSPHRASE use PASSPHRASE for salted input types, inputs\n\ @@ -381,7 +388,8 @@ void usage(unsigned char *name) { -n K/N use only the Kth of every N input lines\n\ -B batch size for affine transformations\n\ must be a power of 2 (default/max: %d)\n\ - -w WINDOW_SIZE window size for ecmult table (default: 16)\n\ + -N number of SHA rounds (used only in '-t shaxn' mode)\n\ + -w WINDOW_SIZE window size for ecmult table (default: 19)\n\ uses about 3 * 2^w KiB memory on startup, but\n\ only about 2^w KiB once the table is built\n\ -m FILE load ecmult table from FILE\n\ @@ -411,10 +419,11 @@ int main(int argc, char **argv) { unsigned char modestr[64]; - int spok = 0, aopt = 0, vopt = 0, wopt = 16, xopt = 0; - int nopt_mod = 0, nopt_rem = 0, Bopt = 0, Nopt = 2; + int spok = 0, aopt = 0, boptn = 0, vopt = 0, wopt = 19, xopt = 0; + int nopt_mod = 0, nopt_rem = 0, Bopt = 0, Copt = 0, Nopt = 2; uint64_t kopt = 0; - unsigned char *bopt = NULL, *iopt = NULL, *oopt = NULL; + unsigned char *bopts[BOPT_MAX]; + unsigned char *iopt = NULL, *oopt = NULL; unsigned char *topt = NULL, *sopt = NULL, *popt = NULL; unsigned char *mopt = NULL, *fopt = NULL, *ropt = NULL; unsigned char *Iopt = NULL, *copt = NULL; @@ -431,7 +440,7 @@ int main(int argc, char **argv) { unsigned char batch_priv[BATCH_MAX][32]; unsigned char batch_upub[BATCH_MAX][65]; - while ((c = getopt(argc, argv, "avxb:hi:k:f:m:n:o:p:s:r:c:t:w:I:B:N:")) != -1) { + while ((c = getopt(argc, argv, "avxb:hi:k:f:m:n:o:p:s:r:c:t:w:CI:B:N:")) != -1) { switch (c) { case 'a': aopt = 1; // open output file in append mode @@ -464,7 +473,13 @@ int main(int argc, char **argv) { vopt = 1; // verbose break; case 'b': - bopt = optarg; // bloom filter file + if (boptn < BATCH_MAX) { + bopts[boptn] = optarg; // bloom filter file + boptn++; + } + else { + fprintf(stderr, "Number of bloom files reached maximum!\n"); + } break; case 'f': fopt = optarg; // full filter file @@ -493,6 +508,9 @@ int main(int argc, char **argv) { case 't': topt = optarg; // type of input break; + case 'C': + Copt = 1; + break; case 'I': Iopt = optarg; // start key for incremental xopt = 1; // input is hex encoded @@ -515,7 +533,7 @@ int main(int argc, char **argv) { if (optind == 1 && argc == 2) { // older versions of brainflayer had the bloom filter file as a // single optional argument, this keeps compatibility with that - bopt = argv[1]; + bopts[0] = argv[1]; } else { fprintf(stderr, "Invalid arguments:\n"); while (optind < argc) { @@ -684,17 +702,26 @@ int main(int argc, char **argv) { snprintf(modestr, sizeof(modestr), xopt ? "(hex)%s" : "%s", topt); - if (bopt) { - if ((ret = mmapf(&bloom_mmapf, bopt, BLOOM_SIZE, MMAPF_RNDRD)) != MMAPF_OKAY) { - bail(1, "failed to open bloom filter '%s': %s\n", bopt, mmapf_strerror(ret)); - } else if (bloom_mmapf.mem == NULL) { - bail(1, "got NULL pointer trying to set up bloom filter\n"); + if (boptn > 0) { + if (vopt) { + printf("Loading... "); } - bloom = bloom_mmapf.mem; + for (int i = 0; i < boptn; i++) { + if (vopt) { + fprintf(stdout, "%s... ", bopts[i]); + } + if ((ret = mmapf(&bloom_mmapf[i], bopts[i], BLOOM_SIZE, MMAPF_RNDRD)) != MMAPF_OKAY) { + bail(1, "failed to open bloom filter '%s': %s\n", bopts[i], mmapf_strerror(ret)); + } else if (bloom_mmapf[i].mem == NULL) { + bail(1, "got NULL pointer trying to set up bloom filter\n"); + } + blooms[i] = bloom_mmapf[i].mem; + } + printf("\n"); } if (fopt) { - if (!bopt) { + if (boptn == 0) { bail(1, "The '-f' option must be used with a bloom filter\n"); } if ((ffile = fopen(fopt, "r")) == NULL) { @@ -757,7 +784,7 @@ int main(int argc, char **argv) { batch_stopped = Bopt; } else { for (i = 0; i < Bopt; ++i) { - if ((batch_line_read[i] = getline(&batch_line[i], &batch_line_sz[i], ifile)-1) > -1) { + if ((batch_line_read[i] = getline(&batch_line[i], &batch_line_sz[i], ifile)) > -1) { if (skipping) { ++raw_lines; if (kopt && raw_lines < kopt) { --i; continue; } @@ -766,7 +793,14 @@ int main(int argc, char **argv) { } else { break; } - batch_line[i][batch_line_read[i]] = 0; + if (!Copt || xopt) { + if (batch_line[i][batch_line_read[i]-1] == '\n') { + batch_line[i][--batch_line_read[i]] = 0; + } + if (batch_line[i][batch_line_read[i]-1] == '\r') { + batch_line[i][--batch_line_read[i]] = 0; + } + } if (xopt) { if (batch_line_read[i] / 2 > unhexed_sz) { unhexed_sz = batch_line_read[i]; @@ -793,41 +827,51 @@ int main(int argc, char **argv) { // loop over the public keys for (i = 0; i < batch_stopped; ++i) { - if (bloom) { /* crack mode */ + if (boptn > 0) { /* crack mode */ // loop over pubkey hash functions for (j = 0; pubhashfn[j].fn != NULL; ++j) { pubhashfn[j].fn(&hash160, batch_upub[i]); - 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); + for (int k = 0; k < boptn; k++) { + unsigned int bit; + bloom = blooms[k]; + 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; } + bit = BH20(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; } + bit = BH21(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; } + bit = BH22(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; } + bit = BH23(hash160.ul); if (BLOOM_GET_BIT(bit) == 0) { continue; } + bit = BH24(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; + k = boptn; // End a for loop. + break; } - fprintresult(ofile, &hash160, pubhashfn[j].id, modestr, batch_line[i]); - ++olines; } } } else { /* generate mode */ diff --git a/ec_pubkey_fast.c b/ec_pubkey_fast.c index d5f0b71..eb540a8 100644 --- a/ec_pubkey_fast.c +++ b/ec_pubkey_fast.c @@ -24,12 +24,12 @@ #include "secp256k1/src/ecmult.h" #include "secp256k1/src/eckey_impl.h" -void secp256k1_ecmult(const secp256k1_ecmult_context_t *ctx, secp256k1_gej_t *r, const secp256k1_gej_t *a, const secp256k1_scalar_t *na, const secp256k1_scalar_t *ng) { +void secp256k1_ecmult(const secp256k1_ecmult_context *ctx, secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_scalar *na, const secp256k1_scalar *ng) { fprintf(stderr, "there is no secp256k1_ecmult %p %p %p %p %p\n", (void*)ctx, (void*)r, (void*)a, (void*)na, (void*)ng); abort(); } -static int secp256k1_eckey_pubkey_parse(secp256k1_ge_t *elem, const unsigned char *pub, int size); +static int secp256k1_eckey_pubkey_parse(secp256k1_ge *elem, const unsigned char *pub, long unsigned int size); #include "mmapf.h" @@ -39,8 +39,8 @@ static int secp256k1_eckey_pubkey_parse(secp256k1_ge_t *elem, const unsigned cha #define SETBIT(T, B, V) (T = V ? T | (1<infinity) { VERIFY_CHECK(rzr == NULL); @@ -244,7 +244,7 @@ static void secp256k1_gej_add_ge_bl(secp256k1_gej_t *r, const secp256k1_gej_t *a } -static void secp256k1_ecmult_gen_bl(secp256k1_gej_t *r, const unsigned char *seckey){ +static void secp256k1_ecmult_gen_bl(secp256k1_gej *r, const unsigned char *seckey){ unsigned char a[256]; for (int j = 0; j < 32; j++){ for (int i = 0; i < 8; i++){ @@ -275,8 +275,8 @@ static void secp256k1_ecmult_gen_bl(secp256k1_gej_t *r, const unsigned char *sec #endif int secp256k1_ec_pubkey_create_precomp(unsigned char *pub_chr, int *pub_chr_sz, const unsigned char *seckey) { - secp256k1_gej_t pj; - secp256k1_ge_t p; + secp256k1_gej pj; + secp256k1_ge p; #ifdef USE_BL_ARITHMETIC secp256k1_ecmult_gen_bl(&pj, seckey); @@ -296,16 +296,16 @@ int secp256k1_ec_pubkey_create_precomp(unsigned char *pub_chr, int *pub_chr_sz, return 0; } -static secp256k1_gej_t *batchpj; -static secp256k1_ge_t *batchpa; -static secp256k1_fe_t *batchaz; -static secp256k1_fe_t *batchai; +static secp256k1_gej *batchpj; +static secp256k1_ge *batchpa; +static secp256k1_fe *batchaz; +static secp256k1_fe *batchai; int secp256k1_ec_pubkey_batch_init(unsigned int num) { - if (!batchpj) { batchpj = malloc(sizeof(secp256k1_gej_t)*num); } - if (!batchpa) { batchpa = malloc(sizeof(secp256k1_ge_t)*num); } - if (!batchaz) { batchaz = malloc(sizeof(secp256k1_fe_t)*num); } - if (!batchai) { batchai = malloc(sizeof(secp256k1_fe_t)*num); } + if (!batchpj) { batchpj = malloc(sizeof(secp256k1_gej)*num); } + if (!batchpa) { batchpa = malloc(sizeof(secp256k1_ge)*num); } + if (!batchaz) { batchaz = malloc(sizeof(secp256k1_fe)*num); } + if (!batchai) { batchai = malloc(sizeof(secp256k1_fe)*num); } if (batchpj == NULL || batchpa == NULL || batchaz == NULL || batchai == NULL) { return 1; } else { @@ -313,13 +313,13 @@ int secp256k1_ec_pubkey_batch_init(unsigned int num) { } } -void secp256k1_ge_set_all_gej_static(int num, secp256k1_ge_t *batchpa, secp256k1_gej_t *batchpj) { +void secp256k1_ge_set_all_gej_static(secp256k1_ge *batchpa, secp256k1_gej *batchpj, int num) { size_t i; for (i = 0; i < num; i++) { batchaz[i] = batchpj[i].z; } - secp256k1_fe_inv_all_var(num, batchai, batchaz); + secp256k1_fe_inv_all_var(batchai, batchaz, num); for (i = 0; i < num; i++) { secp256k1_ge_set_gej_zinv(&batchpa[i], &batchpj[i], &batchai[i]); @@ -335,9 +335,9 @@ int secp256k1_ec_pubkey_batch_incr(unsigned int num, unsigned int skip, unsigned unsigned char b32[32]; - secp256k1_scalar_t priv, incr_s; - secp256k1_gej_t temp; - secp256k1_ge_t incr_a; + secp256k1_scalar priv, incr_s; + secp256k1_gej temp; + secp256k1_ge incr_a; /* load staring private key */ secp256k1_scalar_set_b32(&priv, start, NULL); @@ -370,7 +370,7 @@ int secp256k1_ec_pubkey_batch_incr(unsigned int num, unsigned int skip, unsigned } /* convert all jacobian coordinates to affine */ - secp256k1_ge_set_all_gej_static(num, batchpa, batchpj); + secp256k1_ge_set_all_gej_static(batchpa, batchpj, num); /* write out formatted public key */ for (i = 0; i < num; ++i) { @@ -399,7 +399,7 @@ int secp256k1_ec_pubkey_batch_create(unsigned int num, unsigned char (*pub)[65], } /* convert all jacobian coordinates to affine */ - secp256k1_ge_set_all_gej_static(num, batchpa, batchpj); + secp256k1_ge_set_all_gej_static(batchpa, batchpj, num); /* write out formatted public key */ for (i = 0; i < num; ++i) { @@ -415,7 +415,7 @@ int secp256k1_ec_pubkey_batch_create(unsigned int num, unsigned char (*pub)[65], } int secp256k1_scalar_add_b32(void * out, void * a, void *b) { - secp256k1_scalar_t tmp_a, tmp_b; + secp256k1_scalar tmp_a, tmp_b; secp256k1_scalar_set_b32(&tmp_a, a, NULL); secp256k1_scalar_set_b32(&tmp_b, b, NULL); @@ -452,9 +452,9 @@ void priv_add_uint32(unsigned char *priv, unsigned int add) { } typedef struct { - secp256k1_gej_t pubj; - secp256k1_ge_t inc; - secp256k1_gej_t incj; + secp256k1_gej pubj; + secp256k1_ge inc; + secp256k1_gej incj; unsigned int n; } pubkey_incr_t; @@ -481,7 +481,7 @@ int secp256k1_ec_pubkey_incr_init(unsigned char *seckey, unsigned int add) { } int secp256k1_ec_pubkey_incr(unsigned char *pub_chr, int *pub_chr_sz, unsigned char *seckey) { - secp256k1_ge_t p; + secp256k1_ge p; priv_add_uint32(seckey, pubkey_incr_ctx.n); #ifdef USE_BL_ARITHMETIC @@ -504,7 +504,7 @@ int secp256k1_ec_pubkey_incr(unsigned char *pub_chr, int *pub_chr_sz, unsigned c } void * secp256k1_ec_priv_to_gej(unsigned char *priv) { - secp256k1_gej_t *gej = malloc(sizeof(secp256k1_gej_t)); + secp256k1_gej *gej = malloc(sizeof(secp256k1_gej)); #ifdef USE_BL_ARITHMETIC secp256k1_ecmult_gen_bl(gej, priv); #else @@ -515,17 +515,17 @@ void * secp256k1_ec_priv_to_gej(unsigned char *priv) { } int secp256k1_ec_pubkey_add_gej(unsigned char *pub_chr, int *pub_chr_sz, void *add) { - secp256k1_ge_t in; - secp256k1_ge_t p; + secp256k1_ge in; + secp256k1_ge p; - secp256k1_gej_t out; + secp256k1_gej out; secp256k1_eckey_pubkey_parse(&in, pub_chr, *pub_chr_sz); #ifdef USE_BL_ARITHMETIC - secp256k1_gej_add_ge_bl(&out, (secp256k1_gej_t *)add, &in, NULL); + secp256k1_gej_add_ge_bl(&out, (secp256k1_gej *)add, &in, NULL); #else - secp256k1_gej_add_ge_var(&out, (secp256k1_gej_t *)add, &in, NULL); + secp256k1_gej_add_ge_var(&out, (secp256k1_gej *)add, &in, NULL); #endif secp256k1_ge_set_gej(&p, &out); diff --git a/generate12words.py b/generate12words.py deleted file mode 100644 index 07de127..0000000 --- a/generate12words.py +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 -""" - - -# Bip39 by TheRealLordFractal 2019 - -""" - -import sys -import getopt -import random - -#sys.stdout = open('output.txt','wt') - -help_message = ''' -Bip39 12 Word Random Generator By TheRealLordFractal -Output File Saved as 12words.txt -Command Exntensions: --n or --number : Number of sample code phrases given. (Default is 5) --w or --wordlist : Uses another wordlist to generate code phrases from. -''' - -CODEWORDS = open('wordlist.txt', 'r').readlines() -outputtxt = open('12words.txt', 'w') - -class Usage(Exception): - def __init__(self, msg): - self.msg = msg - -def generate(prefix=False, number=5): - while number > 0: - if prefix == 'TRUE': - print ("Not Supported.") - # word1 = PREFIXES[int(random.uniform(0,len(PREFIXES)))] - elif prefix: - word1 = prefix - else: - word1 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word2 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word3 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word4 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word5 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word6 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word7 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word8 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word9 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word10 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word11 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word12 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - print >> outputtxt, " %s %s %s %s %s %s %s %s %s %s %s %s " % (word1.rstrip(), word2.rstrip(), word3.rstrip(), word4.rstrip(), word5.rstrip(), word6.rstrip(), word7.rstrip(), word8.rstrip(), word9.rstrip(), word10.rstrip(), word11.rstrip(), word12.rstrip()) - - number -= 1 - - -def main(argv=None): - - number = 5 - prefix = False - - if argv is None: - argv = sys.argv - try: - try: - opts, args = getopt.getopt(argv[1:], "hn:p:i:vw:", ["help", "number=", "prefix=", "wordlist="]) - except getopt.error, msg: - raise Usage(msg) - - # option processing - for option, value in opts: - if option == "-v": - verbose = True - if option in ("-h", "--help"): - raise Usage(help_message) - if option in ("-n", "--number"): - number = int(value) - if option in ("-w", "--wordlist"): - global CODEWORDS - print "Importing: %s" % value - CODEWORDS = open(value, 'r').readlines() - if option in ("-p", "--prefixe"): - - print value - - if (value): - prefix = value - else: - prefix = 'TRUE' - - generate(prefix, number) - - except Usage, err: - print >> sys.stderr, sys.argv[0].split("/")[-1] + ": " + str(err.msg) - print >> sys.stderr, "\t for help use --help" - return 2 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/generate3words.py b/generate3words.py deleted file mode 100644 index 26cc49d..0000000 --- a/generate3words.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 -""" -code_phrase_geneator.py - -#Created by Scott Roberts. -#Copyright (c) 2011 TogaFoamParty Studios. All rights reserved. - -# Updated to use Bip39 by TheRealLordFractal 2019 - -""" - -import sys -import getopt -import random - - -help_message = ''' -Code Phrase Generator --n or --number : Number of sample code phrases given. (Default is 5) --p or --prefix : Uses a prefix word along with a random codeword instead of two codewords. --w or --wordlist : Uses another wordlist to generate code phrases from. -''' - -CODEWORDS = open('wordlist.txt', 'r').readlines() - - -class Usage(Exception): - def __init__(self, msg): - self.msg = msg - -def generate(prefix=False, number=5): - while number > 0: - if prefix == 'TRUE': - word1 = PREFIXES[int(random.uniform(0,len(PREFIXES)))] - elif prefix: - word1 = prefix - else: - word1 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - - word2 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word3 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - print " %s %s %s" % (word1.rstrip(), word2.rstrip(), word3.rstrip()) - - number -= 1 - - -def main(argv=None): - - number = 5 - prefix = False - - if argv is None: - argv = sys.argv - try: - try: - opts, args = getopt.getopt(argv[1:], "hn:p:i:vw:", ["help", "number=", "prefix=", "wordlist="]) - except getopt.error, msg: - raise Usage(msg) - - # option processing - for option, value in opts: - if option == "-v": - verbose = True - if option in ("-h", "--help"): - raise Usage(help_message) - if option in ("-n", "--number"): - number = int(value) - if option in ("-w", "--wordlist"): - global CODEWORDS - print "Importing: %s" % value - CODEWORDS = open(value, 'r').readlines() - if option in ("-p", "--prefixe"): - - print value - - if (value): - prefix = value - else: - prefix = 'TRUE' - - generate(prefix, number) - - except Usage, err: - print >> sys.stderr, sys.argv[0].split("/")[-1] + ": " + str(err.msg) - print >> sys.stderr, "\t for help use --help" - return 2 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/generate6words.py b/generate6words.py deleted file mode 100644 index e716535..0000000 --- a/generate6words.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 -""" - - -# Bip39 by TheRealLordFractal 2019 - -""" - -import sys -import getopt -import random - -#sys.stdout = open('output.txt','wt') - -help_message = ''' -Bip39 6 Word Random Generator By TheRealLordFractal -Output File Saved as 12words.txt -Command Exntensions: --n or --number : Number of sample code phrases given. (Default is 5) --w or --wordlist : Uses another wordlist to generate code phrases from. -''' - -CODEWORDS = open('wordlist.txt', 'r').readlines() -outputtxt = open('6words.txt', 'w') - -class Usage(Exception): - def __init__(self, msg): - self.msg = msg - -def generate(prefix=False, number=5): - while number > 0: - if prefix == 'TRUE': - print ("Not Supported.") - # word1 = PREFIXES[int(random.uniform(0,len(PREFIXES)))] - elif prefix: - word1 = prefix - else: - word1 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word2 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word3 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word4 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word5 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word6 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - print >> outputtxt, " %s %s %s %s %s %s " % (word1.rstrip(), word2.rstrip(), word3.rstrip(), word4.rstrip(), word5.rstrip(), word6.rstrip()) - - number -= 1 - - -def main(argv=None): - - number = 5 - prefix = False - - if argv is None: - argv = sys.argv - try: - try: - opts, args = getopt.getopt(argv[1:], "hn:p:i:vw:", ["help", "number=", "prefix=", "wordlist="]) - except getopt.error, msg: - raise Usage(msg) - - # option processing - for option, value in opts: - if option == "-v": - verbose = True - if option in ("-h", "--help"): - raise Usage(help_message) - if option in ("-n", "--number"): - number = int(value) - if option in ("-w", "--wordlist"): - global CODEWORDS - print "Importing: %s" % value - CODEWORDS = open(value, 'r').readlines() - if option in ("-p", "--prefixe"): - - print value - - if (value): - prefix = value - else: - prefix = 'TRUE' - - generate(prefix, number) - - except Usage, err: - print >> sys.stderr, sys.argv[0].split("/")[-1] + ": " + str(err.msg) - print >> sys.stderr, "\t for help use --help" - return 2 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/generators/3.py b/generators/3.py deleted file mode 100755 index f5ef86d..0000000 --- a/generators/3.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 -""" -code_phrase_geneator.py - -#Created by Scott Roberts. -#Copyright (c) 2011 TogaFoamParty Studios. All rights reserved. - -# Updated to use Bip39 by TheRealLordFractal 2019 - -""" - -import sys -import getopt -import random - - -help_message = ''' -Code Phrase Generator --n or --number : Number of sample code phrases given. (Default is 5) --p or --prefix : Uses a prefix word along with a random codeword instead of two codewords. --w or --wordlist : Uses another wordlist to generate code phrases from. -''' - -CODEWORDS = open('wordlist.txt', 'r').readlines() - - -class Usage(Exception): - def __init__(self, msg): - self.msg = msg - -def generate(prefix=False, number=5): - while number > 0: - if prefix == 'TRUE': - word1 = PREFIXES[int(random.uniform(0,len(PREFIXES)))] - elif prefix: - word1 = prefix - else: - word1 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - - word2 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word3 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - print "%s%s%s" % (word1.rstrip(), word2.rstrip(), word3.rstrip()) - - number -= 1 - - -def main(argv=None): - - number = 5 - prefix = False - - if argv is None: - argv = sys.argv - try: - try: - opts, args = getopt.getopt(argv[1:], "hn:p:i:vw:", ["help", "number=", "prefix=", "wordlist="]) - except getopt.error, msg: - raise Usage(msg) - - # option processing - for option, value in opts: - if option == "-v": - verbose = True - if option in ("-h", "--help"): - raise Usage(help_message) - if option in ("-n", "--number"): - number = int(value) - if option in ("-w", "--wordlist"): - global CODEWORDS - print "Importing: %s" % value - CODEWORDS = open(value, 'r').readlines() - if option in ("-p", "--prefixe"): - - print value - - if (value): - prefix = value - else: - prefix = 'TRUE' - - generate(prefix, number) - - except Usage, err: - print >> sys.stderr, sys.argv[0].split("/")[-1] + ": " + str(err.msg) - print >> sys.stderr, "\t for help use --help" - return 2 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/generators/brain12.py b/generators/brain12.py deleted file mode 100755 index 3984de9..0000000 --- a/generators/brain12.py +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 -""" - - -# Bip39 by TheRealLordFractal 2019 - -""" - -import sys -import getopt -import random - -#sys.stdout = open('output.txt','wt') - -help_message = ''' -Bip39 12 Word Random Generator By TheRealLordFractal -Output File Saved as 12words.txt -Command Exntensions: --n or --number : Number of sample code phrases given. (Default is 5) --w or --wordlist : Uses another wordlist to generate code phrases from. -''' - -CODEWORDS = open('wordlist.txt', 'r').readlines() - -class Usage(Exception): - def __init__(self, msg): - self.msg = msg - -def generate(prefix=False, number=5): - while number > 0: - if prefix == 'TRUE': - print ("Not Supported.") - # word1 = PREFIXES[int(random.uniform(0,len(PREFIXES)))] - elif prefix: - word1 = prefix - else: - word1 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word2 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word3 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word4 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word5 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word6 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word7 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word8 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word9 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word10 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word11 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word12 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - print " %s %s %s %s %s %s %s %s %s %s %s %s " % (word1.rstrip(), word2.rstrip(), word3.rstrip(), word4.rstrip(), word5.rstrip(), word6.rstrip(), word7.rstrip(), word8.rstrip(), word9.rstrip(), word10.rstrip(), word11.rstrip(), word12.rstrip()) - - number -= 1 - - -def main(argv=None): - - number = 5 - prefix = False - - if argv is None: - argv = sys.argv - try: - try: - opts, args = getopt.getopt(argv[1:], "hn:p:i:vw:", ["help", "number=", "prefix=", "wordlist="]) - except getopt.error, msg: - raise Usage(msg) - - # option processing - for option, value in opts: - if option == "-v": - verbose = True - if option in ("-h", "--help"): - raise Usage(help_message) - if option in ("-n", "--number"): - number = int(value) - if option in ("-w", "--wordlist"): - global CODEWORDS - print "Importing: %s" % value - CODEWORDS = open(value, 'r').readlines() - if option in ("-p", "--prefixe"): - - print value - - if (value): - prefix = value - else: - prefix = 'TRUE' - - generate(prefix, number) - - except Usage, err: - print >> sys.stderr, sys.argv[0].split("/")[-1] + ": " + str(err.msg) - print >> sys.stderr, "\t for help use --help" - return 2 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/generators/brain24.py b/generators/brain24.py deleted file mode 100755 index f9b0f17..0000000 --- a/generators/brain24.py +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 -""" - - -# Bip39 by TheRealLordFractal 2019 - -""" - -import sys -import getopt -import random - -#sys.stdout = open('output.txt','wt') - -help_message = ''' -Bip39 24 Word Random Generator By TheRealLordFractal -Output File Saved as 24words.txt -Command Exntensions: --n or --number : Number of sample code phrases given. (Default is 5) --w or --wordlist : Uses another wordlist to generate code phrases from. -''' - -CODEWORDS = open('wordlist.txt', 'r').readlines() - -class Usage(Exception): - def __init__(self, msg): - self.msg = msg - -def generate(prefix=False, number=5): - while number > 0: - if prefix == 'TRUE': - print ("Not Supported.") - # word1 = PREFIXES[int(random.uniform(0,len(PREFIXES)))] - elif prefix: - word1 = prefix - else: - word1 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word2 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word3 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word4 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word5 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word6 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word7 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word8 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word9 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word10 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word11 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word12 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word13 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word14 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word15 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word16 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word17 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word18 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word19 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word20 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word21 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word22 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word23 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word24 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - print " %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s " % (word1.rstrip(), word2.rstrip(), word3.rstrip(), word4.rstrip(), word5.rstrip(), word6.rstrip(), word7.rstrip(), word8.rstrip(), word9.rstrip(), word10.rstrip(), word11.rstrip(), word12.rstrip(), word13.rstrip(), word14.rstrip(), word15.rstrip(), word16.rstrip(), word17.rstrip(), word18.rstrip(), word19.rstrip(), word20.rstrip(), word21.rstrip(), word22.rstrip(), word23.rstrip(), word24.rstrip()) - - number -= 1 - - -def main(argv=None): - - number = 5 - prefix = False - - if argv is None: - argv = sys.argv - try: - try: - opts, args = getopt.getopt(argv[1:], "hn:p:i:vw:", ["help", "number=", "prefix=", "wordlist="]) - except getopt.error, msg: - raise Usage(msg) - - # option processing - for option, value in opts: - if option == "-v": - verbose = True - if option in ("-h", "--help"): - raise Usage(help_message) - if option in ("-n", "--number"): - number = int(value) - if option in ("-w", "--wordlist"): - global CODEWORDS - print "Importing: %s" % value - CODEWORDS = open(value, 'r').readlines() - if option in ("-p", "--prefixe"): - - print value - - if (value): - prefix = value - else: - prefix = 'TRUE' - - generate(prefix, number) - - except Usage, err: - print >> sys.stderr, sys.argv[0].split("/")[-1] + ": " + str(err.msg) - print >> sys.stderr, "\t for help use --help" - return 2 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/generators/generate12words.py b/generators/generate12words.py deleted file mode 100755 index 6ef2bc5..0000000 --- a/generators/generate12words.py +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 -""" - - -# Bip39 by TheRealLordFractal 2019 - -""" - -import sys -import getopt -import random - -#sys.stdout = open('output.txt','wt') - -help_message = ''' -Bip39 12 Word Random Generator By TheRealLordFractal -Output File Saved as 12words.txt -Command Exntensions: --n or --number : Number of sample code phrases given. (Default is 5) --w or --wordlist : Uses another wordlist to generate code phrases from. -''' - -CODEWORDS = open('wordlist.txt', 'r').readlines() -outputtxt = open('12words.txt', 'w') - -class Usage(Exception): - def __init__(self, msg): - self.msg = msg - -def generate(prefix=False, number=5): - while number > 0: - if prefix == 'TRUE': - print ("Not Supported.") - # word1 = PREFIXES[int(random.uniform(0,len(PREFIXES)))] - elif prefix: - word1 = prefix - else: - word1 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word2 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word3 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word4 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word5 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word6 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word7 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word8 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word9 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word10 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word11 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word12 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - print >> outputtxt, "%s %s %s %s %s %s %s %s %s %s %s %s" % (word1.rstrip(), word2.rstrip(), word3.rstrip(), word4.rstrip(), word5.rstrip(), word6.rstrip(), word7.rstrip(), word8.rstrip(), word9.rstrip(), word10.rstrip(), word11.rstrip(), word12.rstrip()) - - number -= 1 - - -def main(argv=None): - - number = 5 - prefix = False - - if argv is None: - argv = sys.argv - try: - try: - opts, args = getopt.getopt(argv[1:], "hn:p:i:vw:", ["help", "number=", "prefix=", "wordlist="]) - except getopt.error, msg: - raise Usage(msg) - - # option processing - for option, value in opts: - if option == "-v": - verbose = True - if option in ("-h", "--help"): - raise Usage(help_message) - if option in ("-n", "--number"): - number = int(value) - if option in ("-w", "--wordlist"): - global CODEWORDS - print "Importing: %s" % value - CODEWORDS = open(value, 'r').readlines() - if option in ("-p", "--prefixe"): - - print value - - if (value): - prefix = value - else: - prefix = 'TRUE' - - generate(prefix, number) - - except Usage, err: - print >> sys.stderr, sys.argv[0].split("/")[-1] + ": " + str(err.msg) - print >> sys.stderr, "\t for help use --help" - return 2 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/generators/generate3words.py b/generators/generate3words.py deleted file mode 100755 index 1b701a0..0000000 --- a/generators/generate3words.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 -""" -code_phrase_geneator.py - -#Created by Scott Roberts. -#Copyright (c) 2011 TogaFoamParty Studios. All rights reserved. - -# Updated to use Bip39 by TheRealLordFractal 2019 - -""" - -import sys -import getopt -import random - - -help_message = ''' -Code Phrase Generator --n or --number : Number of sample code phrases given. (Default is 5) --p or --prefix : Uses a prefix word along with a random codeword instead of two codewords. --w or --wordlist : Uses another wordlist to generate code phrases from. -''' - -CODEWORDS = open('wordlist.txt', 'r').readlines() - - -class Usage(Exception): - def __init__(self, msg): - self.msg = msg - -def generate(prefix=False, number=5): - while number > 0: - if prefix == 'TRUE': - word1 = PREFIXES[int(random.uniform(0,len(PREFIXES)))] - elif prefix: - word1 = prefix - else: - word1 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - - word2 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word3 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - print "%s %s %s" % (word1.rstrip(), word2.rstrip(), word3.rstrip()) - - number -= 1 - - -def main(argv=None): - - number = 5 - prefix = False - - if argv is None: - argv = sys.argv - try: - try: - opts, args = getopt.getopt(argv[1:], "hn:p:i:vw:", ["help", "number=", "prefix=", "wordlist="]) - except getopt.error, msg: - raise Usage(msg) - - # option processing - for option, value in opts: - if option == "-v": - verbose = True - if option in ("-h", "--help"): - raise Usage(help_message) - if option in ("-n", "--number"): - number = int(value) - if option in ("-w", "--wordlist"): - global CODEWORDS - print "Importing: %s" % value - CODEWORDS = open(value, 'r').readlines() - if option in ("-p", "--prefixe"): - - print value - - if (value): - prefix = value - else: - prefix = 'TRUE' - - generate(prefix, number) - - except Usage, err: - print >> sys.stderr, sys.argv[0].split("/")[-1] + ": " + str(err.msg) - print >> sys.stderr, "\t for help use --help" - return 2 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/generators/generate6words.py b/generators/generate6words.py deleted file mode 100755 index a75c054..0000000 --- a/generators/generate6words.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 -""" - - -# Bip39 by TheRealLordFractal 2019 - -""" - -import sys -import getopt -import random - -#sys.stdout = open('output.txt','wt') - -help_message = ''' -Bip39 6 Word Random Generator By TheRealLordFractal -Output File Saved as 12words.txt -Command Exntensions: --n or --number : Number of sample code phrases given. (Default is 5) --w or --wordlist : Uses another wordlist to generate code phrases from. -''' - -CODEWORDS = open('wordlist.txt', 'r').readlines() -outputtxt = open('6words.txt', 'w') - -class Usage(Exception): - def __init__(self, msg): - self.msg = msg - -def generate(prefix=False, number=5): - while number > 0: - if prefix == 'TRUE': - print ("Not Supported.") - # word1 = PREFIXES[int(random.uniform(0,len(PREFIXES)))] - elif prefix: - word1 = prefix - else: - word1 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word2 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word3 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word4 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word5 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word6 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - print >> outputtxt, "%s %s %s %s %s %s" % (word1.rstrip(), word2.rstrip(), word3.rstrip(), word4.rstrip(), word5.rstrip(), word6.rstrip()) - - number -= 1 - - -def main(argv=None): - - number = 5 - prefix = False - - if argv is None: - argv = sys.argv - try: - try: - opts, args = getopt.getopt(argv[1:], "hn:p:i:vw:", ["help", "number=", "prefix=", "wordlist="]) - except getopt.error, msg: - raise Usage(msg) - - # option processing - for option, value in opts: - if option == "-v": - verbose = True - if option in ("-h", "--help"): - raise Usage(help_message) - if option in ("-n", "--number"): - number = int(value) - if option in ("-w", "--wordlist"): - global CODEWORDS - print "Importing: %s" % value - CODEWORDS = open(value, 'r').readlines() - if option in ("-p", "--prefixe"): - - print value - - if (value): - prefix = value - else: - prefix = 'TRUE' - - generate(prefix, number) - - except Usage, err: - print >> sys.stderr, sys.argv[0].split("/")[-1] + ": " + str(err.msg) - print >> sys.stderr, "\t for help use --help" - return 2 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/hash160.py b/hash160.py deleted file mode 100644 index 31ff32f..0000000 --- a/hash160.py +++ /dev/null @@ -1,13 +0,0 @@ -import sys -from bit.base58 import b58decode_check -from bit.utils import bytes_to_hex -def address_to_hash160(address): - address_bytes = b58decode_check(address) - address_hash160 = bytes_to_hex(address_bytes)[2:] - - return address_hash160 -with open('list.txt') as textfile: - for line in textfile: - s = (line.rstrip('\n')) - h160=address_to_hash160(s) - print(h160) diff --git a/hex2blf.c b/hex2blf.c index c52db6b..7d8309c 100644 --- a/hex2blf.c +++ b/hex2blf.c @@ -19,8 +19,8 @@ #include "bloom.h" #include "hash160.h" -const double k_hashes = 20; -const double m_bits = 4294967296; +const double k_hashes = 25; +const double m_bits = 4294967296*2; int main(int argc, char **argv) { hash160_t hash; diff --git a/generators/2.py b/scripts/generators/2.py similarity index 84% rename from generators/2.py rename to scripts/generators/2.py index f99bf3c..bc4e80b 100755 --- a/generators/2.py +++ b/scripts/generators/2.py @@ -13,4 +13,4 @@ for line in file2.lines(): id_ = line.split()[0] if id_ in ids: - found.append("{} {}".format(ids[id_], line)) + found.append(f"{ids[id_]} {line}") diff --git a/generate2words.py b/scripts/generators/3.py old mode 100644 new mode 100755 similarity index 58% rename from generate2words.py rename to scripts/generators/3.py index 10db4a1..961a6fd --- a/generate2words.py +++ b/scripts/generators/3.py @@ -15,31 +15,33 @@ import random -help_message = ''' +help_message = """ Code Phrase Generator -n or --number : Number of sample code phrases given. (Default is 5) -p or --prefix : Uses a prefix word along with a random codeword instead of two codewords. -w or --wordlist : Uses another wordlist to generate code phrases from. -''' +""" -CODEWORDS = open('wordlist.txt', 'r').readlines() +CODEWORDS = open("wordlist.txt", "r").readlines() class Usage(Exception): def __init__(self, msg): self.msg = msg + def generate(prefix=False, number=5): while number > 0: - if prefix == 'TRUE': - word1 = PREFIXES[int(random.uniform(0,len(PREFIXES)))] + if prefix == "TRUE": + word1 = PREFIXES[int(random.uniform(0, len(PREFIXES)))] elif prefix: word1 = prefix else: - word1 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] + word1 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] - word2 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - print " %s %s" % (word1.rstrip(), word2.rstrip()) + word2 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + word3 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + print(f"{word1.rstrip()}{word2.rstrip()}{word3.rstrip()}") number -= 1 @@ -53,8 +55,10 @@ def main(argv=None): argv = sys.argv try: try: - opts, args = getopt.getopt(argv[1:], "hn:p:i:vw:", ["help", "number=", "prefix=", "wordlist="]) - except getopt.error, msg: + opts, args = getopt.getopt( + argv[1:], "hn:p:i:vw:", ["help", "number=", "prefix=", "wordlist="] + ) + except getopt.error as msg: raise Usage(msg) # option processing @@ -66,23 +70,19 @@ def main(argv=None): if option in ("-n", "--number"): number = int(value) if option in ("-w", "--wordlist"): - global CODEWORDS - print "Importing: %s" % value - CODEWORDS = open(value, 'r').readlines() + global CODEWORDS + print(f"Importing: {value}") + CODEWORDS = open(value, "r").readlines() if option in ("-p", "--prefixe"): - print value - - if (value): - prefix = value - else: - prefix = 'TRUE' + print(value) + prefix = value if value else "TRUE" generate(prefix, number) - except Usage, err: - print >> sys.stderr, sys.argv[0].split("/")[-1] + ": " + str(err.msg) - print >> sys.stderr, "\t for help use --help" + except Usage as err: + print(sys.argv[0].split("/")[-1] + ": " + str(err.msg), file=sys.stderr) + print("\t for help use --help", file=sys.stderr) return 2 diff --git a/brain12.py b/scripts/generators/brain12.py old mode 100644 new mode 100755 similarity index 100% rename from brain12.py rename to scripts/generators/brain12.py diff --git a/brain12words.py b/scripts/generators/brain12words.py old mode 100644 new mode 100755 similarity index 100% rename from brain12words.py rename to scripts/generators/brain12words.py diff --git a/brain24.py b/scripts/generators/brain24.py old mode 100644 new mode 100755 similarity index 100% rename from brain24.py rename to scripts/generators/brain24.py diff --git a/scripts/generators/generate12words.py b/scripts/generators/generate12words.py new file mode 100755 index 0000000..d03eb90 --- /dev/null +++ b/scripts/generators/generate12words.py @@ -0,0 +1,102 @@ +#!/usr/bin/env python +# encoding: utf-8 +""" + + +# Bip39 by TheRealLordFractal 2019 + +""" + +import sys +import getopt +import random + +# sys.stdout = open('output.txt','wt') + +help_message = """ +Bip39 12 Word Random Generator By TheRealLordFractal +Output File Saved as 12words.txt +Command Exntensions: +-n or --number : Number of sample code phrases given. (Default is 5) +-w or --wordlist : Uses another wordlist to generate code phrases from. +""" + +CODEWORDS = open("wordlist.txt", "r").readlines() +outputtxt = open("12words.txt", "w") + + +class Usage(Exception): + def __init__(self, msg): + self.msg = msg + + +def generate(prefix=False, number=5): + while number > 0: + if prefix == "TRUE": + print("Not Supported.") + # word1 = PREFIXES[int(random.uniform(0,len(PREFIXES)))] + elif prefix: + word1 = prefix + else: + word1 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + word2 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + word3 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + word4 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + word5 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + word6 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + word7 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + word8 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + word9 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + word10 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + word11 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + word12 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + print( + f"{word1.rstrip()} {word2.rstrip()} {word3.rstrip()} {word4.rstrip()} {word5.rstrip()} {word6.rstrip()} {word7.rstrip()} {word8.rstrip()} {word9.rstrip()} {word10.rstrip()} {word11.rstrip()} {word12.rstrip()}", + file=outputtxt, + ) + + number -= 1 + + +def main(argv=None): + + number = 5 + prefix = False + + if argv is None: + argv = sys.argv + try: + try: + opts, args = getopt.getopt( + argv[1:], "hn:p:i:vw:", ["help", "number=", "prefix=", "wordlist="] + ) + except getopt.error as msg: + raise Usage(msg) + + # option processing + for option, value in opts: + if option == "-v": + verbose = True + if option in ("-h", "--help"): + raise Usage(help_message) + if option in ("-n", "--number"): + number = int(value) + if option in ("-w", "--wordlist"): + global CODEWORDS + print(f"Importing: {value}") + CODEWORDS = open(value, "r").readlines() + if option in ("-p", "--prefixe"): + + print(value) + + prefix = value if value else "TRUE" + generate(prefix, number) + + except Usage as err: + print(sys.argv[0].split("/")[-1] + ": " + str(err.msg), file=sys.stderr) + print("\t for help use --help", file=sys.stderr) + return 2 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/generators/generate2words.py b/scripts/generators/generate2words.py similarity index 60% rename from generators/generate2words.py rename to scripts/generators/generate2words.py index 2421cf2..bb23d1c 100755 --- a/generators/generate2words.py +++ b/scripts/generators/generate2words.py @@ -15,31 +15,32 @@ import random -help_message = ''' +help_message = """ Code Phrase Generator -n or --number : Number of sample code phrases given. (Default is 5) -p or --prefix : Uses a prefix word along with a random codeword instead of two codewords. -w or --wordlist : Uses another wordlist to generate code phrases from. -''' +""" -CODEWORDS = open('wordlist.txt', 'r').readlines() +CODEWORDS = open("wordlist.txt", "r").readlines() class Usage(Exception): def __init__(self, msg): self.msg = msg + def generate(prefix=False, number=5): while number > 0: - if prefix == 'TRUE': - word1 = PREFIXES[int(random.uniform(0,len(PREFIXES)))] + if prefix == "TRUE": + word1 = PREFIXES[int(random.uniform(0, len(PREFIXES)))] elif prefix: word1 = prefix else: - word1 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] + word1 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] - word2 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - print "%s %s" % (word1.rstrip(), word2.rstrip()) + word2 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + print(f"{word1.rstrip()} {word2.rstrip()}") number -= 1 @@ -53,8 +54,10 @@ def main(argv=None): argv = sys.argv try: try: - opts, args = getopt.getopt(argv[1:], "hn:p:i:vw:", ["help", "number=", "prefix=", "wordlist="]) - except getopt.error, msg: + opts, args = getopt.getopt( + argv[1:], "hn:p:i:vw:", ["help", "number=", "prefix=", "wordlist="] + ) + except getopt.error as msg: raise Usage(msg) # option processing @@ -66,23 +69,19 @@ def main(argv=None): if option in ("-n", "--number"): number = int(value) if option in ("-w", "--wordlist"): - global CODEWORDS - print "Importing: %s" % value - CODEWORDS = open(value, 'r').readlines() + global CODEWORDS + print(f"Importing: {value}") + CODEWORDS = open(value, "r").readlines() if option in ("-p", "--prefixe"): - print value - - if (value): - prefix = value - else: - prefix = 'TRUE' + print(value) + prefix = value if value else "TRUE" generate(prefix, number) - except Usage, err: - print >> sys.stderr, sys.argv[0].split("/")[-1] + ": " + str(err.msg) - print >> sys.stderr, "\t for help use --help" + except Usage as err: + print(sys.argv[0].split("/")[-1] + ": " + str(err.msg), file=sys.stderr) + print("\t for help use --help", file=sys.stderr) return 2 diff --git a/3.py b/scripts/generators/generate3words.py old mode 100644 new mode 100755 similarity index 58% rename from 3.py rename to scripts/generators/generate3words.py index 9934ffc..01a2d5e --- a/3.py +++ b/scripts/generators/generate3words.py @@ -15,32 +15,33 @@ import random -help_message = ''' +help_message = """ Code Phrase Generator -n or --number : Number of sample code phrases given. (Default is 5) -p or --prefix : Uses a prefix word along with a random codeword instead of two codewords. -w or --wordlist : Uses another wordlist to generate code phrases from. -''' +""" -CODEWORDS = open('wordlist.txt', 'r').readlines() +CODEWORDS = open("wordlist.txt", "r").readlines() class Usage(Exception): def __init__(self, msg): self.msg = msg + def generate(prefix=False, number=5): while number > 0: - if prefix == 'TRUE': - word1 = PREFIXES[int(random.uniform(0,len(PREFIXES)))] + if prefix == "TRUE": + word1 = PREFIXES[int(random.uniform(0, len(PREFIXES)))] elif prefix: word1 = prefix else: - word1 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] + word1 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] - word2 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - word3 = CODEWORDS[int(random.uniform(0,len(CODEWORDS)))] - print "%s%s%s" % (word1.rstrip(), word2.rstrip(), word3.rstrip()) + word2 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + word3 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + print(f"{word1.rstrip()} {word2.rstrip()} {word3.rstrip()}") number -= 1 @@ -54,8 +55,10 @@ def main(argv=None): argv = sys.argv try: try: - opts, args = getopt.getopt(argv[1:], "hn:p:i:vw:", ["help", "number=", "prefix=", "wordlist="]) - except getopt.error, msg: + opts, args = getopt.getopt( + argv[1:], "hn:p:i:vw:", ["help", "number=", "prefix=", "wordlist="] + ) + except getopt.error as msg: raise Usage(msg) # option processing @@ -67,23 +70,19 @@ def main(argv=None): if option in ("-n", "--number"): number = int(value) if option in ("-w", "--wordlist"): - global CODEWORDS - print "Importing: %s" % value - CODEWORDS = open(value, 'r').readlines() + global CODEWORDS + print(f"Importing: {value}") + CODEWORDS = open(value, "r").readlines() if option in ("-p", "--prefixe"): - print value - - if (value): - prefix = value - else: - prefix = 'TRUE' + print(value) + prefix = value if value else "TRUE" generate(prefix, number) - except Usage, err: - print >> sys.stderr, sys.argv[0].split("/")[-1] + ": " + str(err.msg) - print >> sys.stderr, "\t for help use --help" + except Usage as err: + print(sys.argv[0].split("/")[-1] + ": " + str(err.msg), file=sys.stderr) + print("\t for help use --help", file=sys.stderr) return 2 diff --git a/scripts/generators/generate6words.py b/scripts/generators/generate6words.py new file mode 100755 index 0000000..ec56944 --- /dev/null +++ b/scripts/generators/generate6words.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python +# encoding: utf-8 +""" + + +# Bip39 by TheRealLordFractal 2019 + +""" + +import sys +import getopt +import random + +# sys.stdout = open('output.txt','wt') + +help_message = """ +Bip39 6 Word Random Generator By TheRealLordFractal +Output File Saved as 12words.txt +Command Exntensions: +-n or --number : Number of sample code phrases given. (Default is 5) +-w or --wordlist : Uses another wordlist to generate code phrases from. +""" + +CODEWORDS = open("wordlist.txt", "r").readlines() +outputtxt = open("6words.txt", "w") + + +class Usage(Exception): + def __init__(self, msg): + self.msg = msg + + +def generate(prefix=False, number=5): + while number > 0: + if prefix == "TRUE": + print("Not Supported.") + # word1 = PREFIXES[int(random.uniform(0,len(PREFIXES)))] + elif prefix: + word1 = prefix + else: + word1 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + word2 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + word3 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + word4 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + word5 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + word6 = CODEWORDS[int(random.uniform(0, len(CODEWORDS)))] + print( + f"{word1.rstrip()} {word2.rstrip()} {word3.rstrip()} {word4.rstrip()} {word5.rstrip()} {word6.rstrip()}", + file=outputtxt, + ) + + number -= 1 + + +def main(argv=None): + + number = 5 + prefix = False + + if argv is None: + argv = sys.argv + try: + try: + opts, args = getopt.getopt( + argv[1:], "hn:p:i:vw:", ["help", "number=", "prefix=", "wordlist="] + ) + except getopt.error as msg: + raise Usage(msg) + + # option processing + for option, value in opts: + if option == "-v": + verbose = True + if option in ("-h", "--help"): + raise Usage(help_message) + if option in ("-n", "--number"): + number = int(value) + if option in ("-w", "--wordlist"): + global CODEWORDS + print(f"Importing: {value}") + CODEWORDS = open(value, "r").readlines() + if option in ("-p", "--prefixe"): + + print(value) + + prefix = value if value else "TRUE" + generate(prefix, number) + + except Usage as err: + print(sys.argv[0].split("/")[-1] + ": " + str(err.msg), file=sys.stderr) + print("\t for help use --help", file=sys.stderr) + return 2 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/hash160.py b/scripts/hash160.py index 31ff32f..2ea3e31 100644 --- a/scripts/hash160.py +++ b/scripts/hash160.py @@ -1,13 +1,15 @@ import sys from bit.base58 import b58decode_check from bit.utils import bytes_to_hex + + def address_to_hash160(address): address_bytes = b58decode_check(address) - address_hash160 = bytes_to_hex(address_bytes)[2:] - - return address_hash160 -with open('list.txt') as textfile: - for line in textfile: - s = (line.rstrip('\n')) - h160=address_to_hash160(s) - print(h160) + return bytes_to_hex(address_bytes)[2:] + + +with open("list.txt") as textfile: + for line in textfile: + s = line.rstrip("\n") + h160 = address_to_hash160(s) + print(h160) diff --git a/scrypt-jane b/scrypt-jane index 1be9d57..51835d0 160000 --- a/scrypt-jane +++ b/scrypt-jane @@ -1 +1 @@ -Subproject commit 1be9d57162392f11a860bec8005cc3ce5afdd057 +Subproject commit 51835d04a336b3aea0fc8cb3002e9ef6dcb47c7b diff --git a/secp256k1 b/secp256k1 index cc623d5..acb7f97 160000 --- a/secp256k1 +++ b/secp256k1 @@ -1 +1 @@ -Subproject commit cc623d50e43507f1d41490280a06065bf7fa3128 +Subproject commit acb7f97eb82dfbbdb797354e1550b910055b4422 diff --git a/defcoin_stealme.hex b/tests/defcoin_stealme.hex similarity index 100% rename from defcoin_stealme.hex rename to tests/defcoin_stealme.hex diff --git a/electrum-mnemonic-1626.txt b/tests/electrum-mnemonic-1626.txt similarity index 100% rename from electrum-mnemonic-1626.txt rename to tests/electrum-mnemonic-1626.txt diff --git a/example.hex b/tests/example.hex similarity index 100% rename from example.hex rename to tests/example.hex