MCPcopy Create free account
hub / github.com/ElementsProject/elements / IsCompressedPubKey

Function IsCompressedPubKey

src/script/interpreter.cpp:167–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165}
166
167bool static IsCompressedPubKey(const valtype &vchPubKey) {
168 if (vchPubKey.size() != CPubKey::COMPRESSED_SIZE) {
169 // Non-canonical public key: invalid length for compressed key
170 return false;
171 }
172 if (vchPubKey[0] != 0x02 && vchPubKey[0] != 0x03) {
173 // Non-canonical public key: invalid prefix for compressed key
174 return false;
175 }
176 return true;
177}
178
179/**
180 * A canonical signature exists of: <30> <total len> <02> <len R> <R> <02> <len S> <S> <hashtype>

Callers 1

CheckPubKeyEncodingFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected