This repository contains thirteen tightly scoped crates. The sections below describe each crate, the public APIs it exports today, and where to look in the source tree.
Location: cardano-crypto-class/src
This is the largest crate in the workspace and provides the primitives used by Cardano consensus and cross-chain tooling.
- DSIGN algorithms (
dsign/): implements Ed25519 (including mlocked variants for secure memory), ECDSA over secp256k1, and Schnorr secp256k1 bindings. Traits are defined indsign/mod.rswith algorithm-specific implementations under the same directory. - KES (Key Evolving Signatures) (
kes/): exposesSingleKes,Sum{0-7}Kes, and compact variants alongside Blake2b hash helpers. All behaviour hangs off theKesAlgorithmtrait. - VRF wrappers (
vrf/): provides Praos VRF types plus helper wrappers for mock implementations. The high-level API lives invrf/mod.rswith Praos-specific code underpraos.rsandpraos_batch.rs. - Seed and secure memory utilities (
seed.rs,mlocked_bytes.rs,mlocked_seed.rs,pinned_sized_bytes.rs): zero-overhead wrappers around byte buffers that erase sensitive material on drop. - Direct serialisation helpers (
direct_serialise.rs): zero-copy readers/writers used across cryptographic keys. - Hashing utilities (
hash.rs): Blake2b plus SHA-2, SHA-3, Keccak, and RIPEMD-160 helpers for cross-chain workflows. - Support code (
util.rs,packed_bytes.rs): big integer helpers and packed byte buffers mirroring the Haskell behaviour.
Tests: cargo test -p cardano-crypto-class currently executes 83 unit tests and 39
integration tests across the cryptographic surface (see the crate-level tests/
directory).
Location: cardano-vrf-pure/src
Implements Draft-03 and Draft-13 VRF suites directly on top of curve25519-dalek:
draft03.rsanddraft13.rsprovide deterministic key generation, proof creation, and verification.common.rscontains hash-to-curve helpers and shared math utilities.
The crate exposes VrfDraft03 / VrfDraft13 along with the VrfError enum.
Location: cardano-binary/src
Offers CBOR serialisation helpers with APIs mirroring the Haskell cardano-binary
package. See serialize.rs for encoding helpers and
deserialize.rs for strict decoding and nested
CBOR support. Errors are reported through
BinaryError.
Location: cardano-slotting/src
Provides strongly typed wrappers around slots, epochs, relative time, and schedule information. Key modules include:
slot.rs:SlotNo,EpochNo, andWithOriginhelpers.time.rs: conversions between wall-clock and Cardano slot timing.epoch_info: utilities for fixed and derived epoch schedules.block.rs: simple block number wrapper.
Location: cardano-base/src
Currently supplies the CardanoFeatureFlag enum and parsing helpers used by downstream
components that need to toggle experimental protocol features.
cardano-strict-containers— strict versions ofMaybe,Seq, and finger trees. Modules live undercardano-strict-containers/src.deepseq— ports the HaskellNFDatahierarchy. Seedeepseq/src/lib.rs.nothunks— structural thunk detection wrappers (mirroring the Haskellnothunkspackage). Source atnothunks/src/lib.rs.measures— size accounting helpers and theMeasuretrait, implemented inmeasures/src/measure.rs.heapwords— heuristic memory accounting for various data structures, keeping parity with the Haskell implementation. Located atheapwords/src/lib.rs.
base-deriving-via— providesGeneric,Semigroup, andMonoidderivation helpers plus theInstantiatedAtwrapper (seebase-deriving-via/src/lib.rs).orphans-deriving-via— re-exports thedeepseq/nothunksintegration helpers so downstream code can depend on a single crate.
cardano-git-rev— exposesgit_rev()to bundle the repo revision into binaries without shelling out at runtime.
Running cargo test --workspace (October 2025) executes roughly 190 unit and integration
checks. Notable suites:
cardano-crypto-class/tests/cross_algorithm_verification.rscovers cross-chain signing workflows and hash checks.cardano-crypto-class/tests/vrf_praos_vectors.rsvalidates outputs against known test vectors undertest_vectors/.cardano-slotting/tests/slotting.rsenforces arithmetic over slot numbers and epoch schedules.- Strict container,
deepseq, andnothunkscrates contain comprehensive unit tests to guarantee compatibility with the original Haskell behaviour.
Refer back to this document whenever you add a new crate or expand responsibilities so the map stays aligned with the code.