17 memcpy(&hash, &script[3], 20);
27 memcpy(&hash, &script[2], 20);
36 && (
script[1] == 0x02 || script[1] == 0x03)) {
37 pubkey.
Set(&script[1], &script[34]);
40 if (script.size() == 67 && script[0] == 65 && script[66] ==
OP_CHECKSIG 41 && script[1] == 0x04) {
42 pubkey.
Set(&script[1], &script[66]);
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)
104 memcpy(&script[2], in.data(), 20);
112 memcpy(&script[2], in.data(), 32);
117 unsigned char vch[33] = {};
119 memcpy(&vch[1], in.data(), 32);
120 CPubKey pubkey(&vch[0], &vch[33]);
121 if (!pubkey.Decompress())
123 assert(pubkey.size() == 65);
126 memcpy(&script[1], pubkey.begin(), 65);
147 while (((n % 10) == 0) && e < 9) {
155 return 1 + (n*9 + d - 1)*10 + e;
157 return 1 + (n - 1)*10 + 9;
bool IsToKeyID(CKeyID &hash) const
These check for scripts for which a special case with a shorter encoding is defined.
void resize(size_type new_size)
bool Compress(std::vector< unsigned char > &out) const
unsigned int GetSpecialSize(unsigned int nSize) 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
assert(len-trim+(2 *lenIndices)<=WIDTH)
bool IsToScriptID(CScriptID &hash) const
An encapsulated public key.
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.
bool IsFullyValid() const
fully validate whether this is a valid public key (more expensive than IsValid()) ...
A reference to a CScript: the Hash160 of its serialization (see script.h)