| 31 | |
| 32 | #ifdef KEY_TESTS_DUMPINFO |
| 33 | void dumpKeyInfo(uint256 privkey) |
| 34 | { |
| 35 | CKey key; |
| 36 | key.resize(32); |
| 37 | memcpy(&secret[0], &privkey, 32); |
| 38 | vector<unsigned char> sec; |
| 39 | sec.resize(32); |
| 40 | memcpy(&sec[0], &secret[0], 32); |
| 41 | printf(" * secret (hex): %s\n", HexStr(sec).c_str()); |
| 42 | |
| 43 | for (int nCompressed=0; nCompressed<2; nCompressed++) |
| 44 | { |
| 45 | bool fCompressed = nCompressed == 1; |
| 46 | printf(" * %s:\n", fCompressed ? "compressed" : "uncompressed"); |
| 47 | CCoinSecret bsecret; |
| 48 | bsecret.SetSecret(secret, fCompressed); |
| 49 | printf(" * secret (base58): %s\n", bsecret.ToString().c_str()); |
| 50 | CKey key; |
| 51 | key.SetSecret(secret, fCompressed); |
| 52 | vector<unsigned char> vchPubKey = key.GetPubKey(); |
| 53 | printf(" * pubkey (hex): %s\n", HexStr(vchPubKey).c_str()); |
| 54 | printf(" * address (base58): %s\n", CCoinAddress(vchPubKey).ToString().c_str()); |
| 55 | } |
| 56 | } |
| 57 | #endif |
| 58 | |
| 59 | |