rippled
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ripple::detail::Generator Class Reference

Produces a sequence of secp256k1 key pairs. More...

Collaboration diagram for ripple::detail::Generator:
Collaboration graph
[legend]

Public Member Functions

 Generator (Seed const &seed)
 
 ~Generator ()
 
std::pair< PublicKey, SecretKeyoperator() (std::size_t ordinal) const
 Generate the nth key pair. More...
 

Private Member Functions

uint256 calculateTweak (std::uint32_t seq) const
 

Private Attributes

uint256 root_
 
std::array< std::uint8_t, 33 > generator_
 

Detailed Description

Produces a sequence of secp256k1 key pairs.

The reference implementation of the XRP Ledger uses a custom derivation algorithm which enables the derivation of an entire family of secp256k1 keypairs from a single 128-bit seed. The algorithm predates widely-used standards like BIP-32 and BIP-44.

Important note to implementers:

Using this algorithm is not required: all valid secp256k1 keypairs will
work correctly. Third party implementations can use whatever mechanisms
they prefer. However, implementers of wallets or other tools that allow
users to use existing accounts should consider at least supporting this
derivation technique to make it easier for users to 'import' accounts.

For more details, please check out: https://xrpl.org/cryptographic-keys.html#secp256k1-key-derivation

Definition at line 120 of file SecretKey.cpp.

Constructor & Destructor Documentation

◆ Generator()

ripple::detail::Generator::Generator ( Seed const &  seed)
explicit

Definition at line 161 of file SecretKey.cpp.

◆ ~Generator()

ripple::detail::Generator::~Generator ( )

Definition at line 180 of file SecretKey.cpp.

Member Function Documentation

◆ calculateTweak()

uint256 ripple::detail::Generator::calculateTweak ( std::uint32_t  seq) const
private

Definition at line 127 of file SecretKey.cpp.

◆ operator()()

std::pair<PublicKey, SecretKey> ripple::detail::Generator::operator() ( std::size_t  ordinal) const

Generate the nth key pair.

Definition at line 188 of file SecretKey.cpp.

Member Data Documentation

◆ root_

uint256 ripple::detail::Generator::root_
private

Definition at line 123 of file SecretKey.cpp.

◆ generator_

std::array<std::uint8_t, 33> ripple::detail::Generator::generator_
private

Definition at line 124 of file SecretKey.cpp.