18 memcpy(&hash, &script[3], 20);
28 memcpy(&hash, &script[2], 20);
37 && (
script[1] == 0x02 || script[1] == 0x03)) {
38 pubkey.
Set(&script[1], &script[34]);
41 if (script.size() == 67 && script[0] == 65 && script[66] ==
OP_CHECKSIG 42 && script[1] == 0x04) {
43 pubkey.
Set(&script[1], &script[66]);
55 memcpy(&out[1], &keyID, 20);
62 memcpy(&out[1], &scriptID, 20);
68 memcpy(&out[1], &pubkey[1], 32);
69 if (pubkey[0] == 0x02 || pubkey[0] == 0x03) {
72 }
else if (pubkey[0] == 0x04) {
73 out[0] = 0x04 | (pubkey[64] & 0x01);
82 if (nSize == 0 || nSize == 1)
84 if (nSize == 2 || nSize == 3 || nSize == 4 || nSize == 5)
105 memcpy(&script[2], in.data(), 20);
113 memcpy(&script[2], in.data(), 32);
118 unsigned char vch[33] = {};
120 memcpy(&vch[1], in.data(), 32);
121 CPubKey pubkey(&vch[0], &vch[33]);
122 if (!pubkey.Decompress())
124 assert(pubkey.size() == 65);
127 memcpy(&script[1], pubkey.begin(), 65);
148 while (((n % 10) == 0) && e < 9) {
154 assert(d >= 1 && d <= 9);
156 return 1 + (n*9 + d - 1)*10 + e;
158 return 1 + (n - 1)*10 + 9;
void resize(size_type new_size)
bool IsToPubKey(CPubKey &pubkey) const
void Set(const T pbegin, const T pend)
Initialize a public key using begin/end iterators to byte data.
bool IsToKeyID(CKeyID &hash) const
These check for scripts for which a special case with a shorter encoding is defined.
bool IsFullyValid() const
fully validate whether this is a valid public key (more expensive than IsValid()) ...
An encapsulated public key.
unsigned int GetSpecialSize(unsigned int nSize) const
static uint64_t CompressAmount(uint64_t nAmount)
static uint64_t DecompressAmount(uint64_t nAmount)
bool Decompress(unsigned int nSize, const std::vector< unsigned char > &out)
void * memcpy(void *a, const void *b, size_t c)
A reference to a CKey: the Hash160 of its serialized public key.
A reference to a CScript: the Hash160 of its serialization (see script.h)
bool IsToScriptID(CScriptID &hash) const
bool Compress(std::vector< unsigned char > &out) const