(18 . 6)(18 . 7)
5 #include <string>
6 #include <vector>
7 #include "bignum.h"
8 #include "key.h"
9
10 static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
11
(313 . 6)(314 . 53)
13 memcpy(&hash160, &vchData[0], 20);
14 return hash160;
15 }
16
17 };
18
19 /** A base58-encoded secret key */
20 class CBitcoinSecret : public CBase58Data
21 {
22 public:
23 void SetSecret(const CSecret& vchSecret)
24 {
25 assert(vchSecret.size() == 32);
26 SetData(128, &vchSecret[0], vchSecret.size());
27 }
28
29 CSecret GetSecret()
30 {
31 CSecret vchSecret;
32 vchSecret.resize(32);
33 memcpy(&vchSecret[0], &vchData[0], 32);
34 return vchSecret;
35 }
36
37 bool IsValid() const
38 {
39 bool fExpectTestNet = false;
40 switch(nVersion)
41 {
42 case 128:
43 break;
44
45 case 239:
46 fExpectTestNet = true;
47 break;
48
49 default:
50 return false;
51 }
52 return (vchData.size() == 32 || (vchData.size() == 33 && vchData[32] == 1));
53 }
54
55 CBitcoinSecret(const CSecret& vchSecret)
56 {
57 SetSecret(vchSecret);
58 }
59
60 CBitcoinSecret()
61 {
62 }
63 };
64
65 #endif