Skip to content

Commit

Permalink
Code cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanLucPons committed Jan 7, 2020
1 parent 4518d6d commit db87f29
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
24 changes: 12 additions & 12 deletions Vanity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1182,13 +1182,13 @@ void VanitySearch::checkAddressesSSE(bool compressed,Int key, int i, Point p1, P
pr2 = *(prefix_t *)h2;
pr3 = *(prefix_t *)h3;

if (hasPattern || prefixes[pr0].items)
if (prefixes[pr0].items)
checkAddr(pr0, h0, key, -i, 0, compressed);
if (hasPattern || prefixes[pr1].items)
if (prefixes[pr1].items)
checkAddr(pr1, h1, key, -(i + 1), 0, compressed);
if (hasPattern || prefixes[pr2].items)
if (prefixes[pr2].items)
checkAddr(pr2, h2, key, -(i + 2), 0, compressed);
if (hasPattern || prefixes[pr3].items)
if (prefixes[pr3].items)
checkAddr(pr3, h3, key, -(i + 3), 0, compressed);

} else {
Expand All @@ -1214,13 +1214,13 @@ void VanitySearch::checkAddressesSSE(bool compressed,Int key, int i, Point p1, P
pr2 = *(prefix_t *)h2;
pr3 = *(prefix_t *)h3;

if (hasPattern || prefixes[pr0].items)
if (prefixes[pr0].items)
checkAddr(pr0, h0, key, -i, 1, compressed);
if (hasPattern || prefixes[pr1].items)
if (prefixes[pr1].items)
checkAddr(pr1, h1, key, -(i + 1), 1, compressed);
if (hasPattern || prefixes[pr2].items)
if (prefixes[pr2].items)
checkAddr(pr2, h2, key, -(i + 2), 1, compressed);
if (hasPattern || prefixes[pr3].items)
if (prefixes[pr3].items)
checkAddr(pr3, h3, key, -(i + 3), 1, compressed);

} else {
Expand All @@ -1245,13 +1245,13 @@ void VanitySearch::checkAddressesSSE(bool compressed,Int key, int i, Point p1, P
pr2 = *(prefix_t *)h2;
pr3 = *(prefix_t *)h3;

if (hasPattern || prefixes[pr0].items)
if (prefixes[pr0].items)
checkAddr(pr0, h0, key, -i, 2, compressed);
if (hasPattern || prefixes[pr1].items)
if (prefixes[pr1].items)
checkAddr(pr1, h1, key, -(i + 1), 2, compressed);
if (hasPattern || prefixes[pr2].items)
if (prefixes[pr2].items)
checkAddr(pr2, h2, key, -(i + 2), 2, compressed);
if (hasPattern || prefixes[pr3].items)
if (prefixes[pr3].items)
checkAddr(pr3, h3, key, -(i + 3), 2, compressed);

} else {
Expand Down
18 changes: 10 additions & 8 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "hash/sha512.h"
#include "hash/sha256.h"

#define RELEASE "1.15"
#define RELEASE "1.16"

using namespace std;

Expand Down Expand Up @@ -61,7 +61,7 @@ void printUsage() {
printf(" -rp privkey partialkeyfile: Reconstruct final private key(s) from partial key(s) info.\n");
printf(" -sp startPubKey: Start the search with a pubKey (for private key splitting)\n");
printf(" -r rekey: Rekey interval in MegaKey, default is disabled\n");
exit(-1);
exit(0);

}

Expand Down Expand Up @@ -167,15 +167,15 @@ void generateKeyPair(Secp256K1 *secp, string seed, int searchMode,bool paranoiac
if (seed.length() < 8) {
printf("Error: Use a seed of at leats 8 characters to generate a key pair\n");
printf("Ex: VanitySearch -s \"A Strong Password\" -kp\n");
exit(0);
exit(-1);
}

if(paranoiacSeed)
seed = seed + Timer::getSeed(32);

if (searchMode == SEARCH_BOTH) {
printf("Error: Use compressed or uncompressed to generate a key pair\n");
exit(0);
exit(-1);
}

bool compressed = (searchMode == SEARCH_COMPRESSED);
Expand Down Expand Up @@ -376,8 +376,8 @@ int main(int argc, char* argv[]) {

// Browse arguments
if (argc < 2) {
printf("Not enough argument\n");
printUsage();
printf("Error: Not enough argument (use -h for help)");
exit(-1);
}

int a = 1;
Expand Down Expand Up @@ -514,12 +514,14 @@ int main(int argc, char* argv[]) {
a++;
rekey = (uint64_t)getInt("rekey", argv[a]);
a++;
} else if (strcmp(argv[a], "-h") == 0) {
printUsage();
} else if (a == argc - 1) {
prefix.push_back(string(argv[a]));
a++;
} else {
printf("Unexpected %s argument\n",argv[a]);
printUsage();
exit(-1);
}

}
Expand All @@ -533,7 +535,7 @@ int main(int argc, char* argv[]) {
}
} else if(gridSize.size() != gpuId.size()*2) {
printf("Invalid gridSize or gpuId argument, must have coherent size\n");
printUsage();
exit(-1);
}

// Let one CPU core free per gpu is gpu is enabled
Expand Down

0 comments on commit db87f29

Please sign in to comment.