mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-13 22:24:05 +01:00
Add ElligatorSwift key creation and ECDH logic
Co-authored-by: Dhruv Mehta <856960+dhruv@users.noreply.github.com>
This commit is contained in:
22
src/pubkey.h
22
src/pubkey.h
@@ -291,6 +291,28 @@ public:
|
||||
SERIALIZE_METHODS(XOnlyPubKey, obj) { READWRITE(obj.m_keydata); }
|
||||
};
|
||||
|
||||
/** An ElligatorSwift-encoded public key. */
|
||||
struct EllSwiftPubKey
|
||||
{
|
||||
private:
|
||||
static constexpr size_t SIZE = 64;
|
||||
std::array<std::byte, SIZE> m_pubkey;
|
||||
|
||||
public:
|
||||
/** Construct a new ellswift public key from a given serialization. */
|
||||
EllSwiftPubKey(const std::array<std::byte, SIZE>& ellswift) :
|
||||
m_pubkey(ellswift) {}
|
||||
|
||||
/** Decode to normal compressed CPubKey (for debugging purposes). */
|
||||
CPubKey Decode() const;
|
||||
|
||||
// Read-only access for serialization.
|
||||
const std::byte* data() const { return m_pubkey.data(); }
|
||||
static constexpr size_t size() { return SIZE; }
|
||||
auto begin() const { return m_pubkey.cbegin(); }
|
||||
auto end() const { return m_pubkey.cend(); }
|
||||
};
|
||||
|
||||
struct CExtPubKey {
|
||||
unsigned char version[4];
|
||||
unsigned char nDepth;
|
||||
|
||||
Reference in New Issue
Block a user