54 memcpy(&out[1], &keyID, 20);
61 memcpy(&out[1], &scriptID, 20);
67 memcpy(&out[1], &pubkey[1], 32);
68 if (pubkey[0] == 0x02 || pubkey[0] == 0x03) {
71 }
else if (pubkey[0] == 0x04) {
72 out[0] = 0x04 | (pubkey[64] & 0x01);
81 if (nSize == 0 || nSize == 1)
83 if (nSize == 2 || nSize == 3 || nSize == 4 || nSize == 5)
117 unsigned char vch[33] = {};
119 memcpy(&vch[1], &in[0], 32);
120 CPubKey pubkey(&vch[0], &vch[33]);
123 assert(pubkey.
size() == 65);
147 while (((n % 10) == 0) && e < 9) {
153 assert(d >= 1 && d <= 9);
155 return 1 + (n*9 + d - 1)*10 + e;
157 return 1 + (n - 1)*10 + 9;
A reference to a CKey: the Hash160 of its serialized public key.
An encapsulated public key.
bool Decompress()
Turn this public key into an uncompressed public key.
bool IsFullyValid() const
fully validate whether this is a valid public key (more expensive than IsValid())
unsigned int size() const
Simple read-only vector-like interface to the pubkey data.
const unsigned char * begin() const
void Set(const T pbegin, const T pend)
Initialize a public key using begin/end iterators to byte data.
bool IsToPubKey(CPubKey &pubkey) const
bool Decompress(unsigned int nSize, const std::vector< unsigned char > &out)
bool IsToKeyID(CKeyID &hash) const
These check for scripts for which a special case with a shorter encoding is defined.
bool Compress(std::vector< unsigned char > &out) const
bool IsToScriptID(CScriptID &hash) const
unsigned int GetSpecialSize(unsigned int nSize) const
A reference to a CScript: the Hash160 of its serialization (see script.h)
static uint64_t CompressAmount(uint64_t nAmount)
static uint64_t DecompressAmount(uint64_t nAmount)
void resize(size_type new_size)
void * memcpy(void *a, const void *b, size_t c)