add Litecoin address and compressed address support

This commit is contained in:
2013-05-16 10:29:03 -07:00
parent cd1a728243
commit 7ee7d9b0aa
5 changed files with 81 additions and 11 deletions

View File

@@ -114,7 +114,7 @@ vg_thread_loop(void *arg)
} else {
eckey_buf = hash_buf;
hash_len = 65;
hash_len = (vcp->vc_compressed)?33:65;
}
while (!vcp->vc_halt) {
@@ -194,11 +194,11 @@ vg_thread_loop(void *arg)
for (i = 0; i < nbatch; i++, vxcp->vxc_delta++) {
/* Hash the public key */
len = EC_POINT_point2oct(pgroup, ppnt[i],
POINT_CONVERSION_UNCOMPRESSED,
(vcp->vc_compressed)?POINT_CONVERSION_COMPRESSED:POINT_CONVERSION_UNCOMPRESSED,
eckey_buf,
65,
(vcp->vc_compressed)?33:65,
vxcp->vxc_bnctx);
assert(len == 65);
assert(len == 65 || len == 33);
SHA256(hash_buf, hash_len, hash1);
RIPEMD160(hash1, sizeof(hash1), &vxcp->vxc_binres[1]);
@@ -311,10 +311,11 @@ usage(const char *name)
"-i Case-insensitive prefix search\n"
"-k Keep pattern and continue search after finding a match\n"
"-1 Stop after first match\n"
"-L Generate litecoin address\n"
"-N Generate namecoin address\n"
"-T Generate bitcoin testnet address\n"
"-X <version> Generate address with the given version\n"
"-F <format> Generate address with the given format (pubkey or script)\n"
"-F <format> Generate address with the given format (pubkey, compressed, script)\n"
"-P <pubkey> Specify base public key for piecewise key generation\n"
"-e Encrypt private keys, prompt for password\n"
"-E <password> Encrypt private keys with <password> (UNSAFE)\n"
@@ -358,11 +359,15 @@ main(int argc, char **argv)
int pattfpi[MAX_FILE];
int npattfp = 0;
int pattstdin = 0;
int compressed = 0;
int i;
while ((opt = getopt(argc, argv, "vqnrik1eE:P:NTX:F:t:h?f:o:s:")) != -1) {
while ((opt = getopt(argc, argv, "Lvqnrik1eE:P:NTX:F:t:h?f:o:s:")) != -1) {
switch (opt) {
case 'c':
compressed = 1;
break;
case 'v':
verbose = 2;
break;
@@ -389,6 +394,11 @@ main(int argc, char **argv)
privtype = 180;
scriptaddrtype = -1;
break;
case 'L':
addrtype = 48;
privtype = 176;
scriptaddrtype = -1;
break;
case 'T':
addrtype = 111;
privtype = 239;
@@ -402,7 +412,10 @@ main(int argc, char **argv)
case 'F':
if (!strcmp(optarg, "script"))
format = VCF_SCRIPT;
else
else
if (!strcmp(optarg, "compressed"))
compressed = 1;
else
if (strcmp(optarg, "pubkey")) {
fprintf(stderr,
"Invalid format '%s'\n", optarg);
@@ -544,6 +557,7 @@ main(int argc, char **argv)
caseinsensitive);
}
vcp->vc_compressed = compressed;
vcp->vc_verbose = verbose;
vcp->vc_result_file = result_file;
vcp->vc_remove_on_match = remove_on_match;