id: crypto title: Crypto
The crypto component hosts all the implementations of cryptographic primitives we use in Libra: hashing, signing, and key derivation/generation. The parts of the library usig traits.rs contain the crypto API enforcing type safety, verifiable random functions, EdDSA & BLS signatures.
Libra makes use of several cryptographic algorithms:
crypto/src
├── hash.rs # Hash function (SHA-3)
├── hkdf.rs # HKDF implementation (HMAC-based Extract-and-Expand Key Derivation Function based on RFC 5869)
├── macros/ # Derivations for SilentDebug and SilentDisplay
├── utils.rs # Serialization utility functions
├── lib.rs
├── bls12381.rs # Bls12-381 implementation of the signing/verification API in traits.rs
├── ed25519.rs # Ed25519 implementation of the signing/verification API in traits.rs
├── slip0010.rs # SLIP-0010 universal hierarchical key derivation for Ed25519
├── x25519.rs # X25519 keys generation
├── test_utils.rs
├── traits.rs # New API design and the necessary abstractions
├── unit_tests/ # Tests
└── vrf/
├── ecvrf.rs # ECVRF implementation using curve25519 and SHA512
├── mod.rs
└── unit_tests # Tests