subsystem-summary-of-crypto

Installation
SKILL.md

Crypto Subsystem Technical Summary

Overview

The src/crypto/ subsystem provides all cryptographic primitives for stellar-core: hashing (SHA-256, BLAKE2b, SipHash), Ed25519 key management and signatures, Curve25519 ECDH key agreement, StrKey encoding/decoding, hex utilities, and random number generation. It is built on top of libsodium and uses xdrpp for serialization. There are no background threads or event loops in this subsystem; it is a stateless utility layer with one notable piece of process-wide shared state: the signature verification cache.


Key Classes and Data Structures

ByteSlice (ByteSlice.h)

A lightweight, non-owning, read-only view over contiguous byte data. Acts as a universal adaptor for passing byte containers into crypto functions. Implicitly constructs from xdr::opaque_array<N>, xdr::msg_ptr, std::vector<uint8_t>, std::string, rust::Vec<uint8_t>, RustBuf, char const*, and raw (void*, size_t). Provides data(), size(), begin(), end(), operator[] (bounds-checked), and empty().

CryptoError (CryptoError.h)

Simple exception class inheriting std::runtime_error. Thrown by all crypto functions on failure (e.g., libsodium errors, invalid inputs).

SecretKey (SecretKey.h / SecretKey.cpp)

Represents an Ed25519 signing keypair (secret key + derived public key).

Related skills
Installs
1
GitHub Stars
3.3K
First Seen
14 days ago