MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / IsCompressedPubKey

Function IsCompressedPubKey

src/script/interpreter.cpp:96–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96bool static IsCompressedPubKey(const valtype &vchPubKey) {
97 if (vchPubKey.size() != CPubKey::COMPRESSED_SIZE) {
98 // Non-canonical public key: invalid length for compressed key
99 return false;
100 }
101 if (vchPubKey[0] != 0x02 && vchPubKey[0] != 0x03) {
102 // Non-canonical public key: invalid prefix for compressed key
103 return false;
104 }
105 return true;
106}
107
108/**
109 * 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