Horcrux is a distributed threshold secret vault built using Shamir’s Secret Sharing. It splits a secret into multiple shares and distributes them across independent nodes (holders), such that only a threshold number (k) of shares can reconstruct the secret.
This ensures:
- No single node can access the secret
- Fault tolerance against node failures
- Strong cryptographic guarantees
- Threshold secret sharing
(k, n) - Distributed holder nodes (independent processes)
- Vault for orchestration and reconstruction
- CLI for end-to-end interaction
- Failure-tolerant unlock flow
- Hash-based secret verification (no secret leakage)
- A secret is split into
nshares using Shamir’s Secret Sharing - Each share is stored in a separate Holder node
- The Vault requests shares from holders
- If ≥
kshares are collected:- Secret is reconstructed
- Hash is returned as proof
flowchart LR
CLI[CLI] -->|unlock request| Vault
Vault -->|GET /share| H1[Holder 1]
Vault -->|GET /share| H2[Holder 2]
Vault -->|GET /share| H3[Holder 3]
Vault -->|GET /share| HN[Holder N]
H1 -->|share| Vault
H2 -->|share| Vault
H3 -->|share| Vault
HN -->|share| Vault
Vault -->|reconstruct (k shares)| Core[Shamir Core]
Core --> Vault
Vault -->|hash output| CLI
crates/
├── horcrux-core # Cryptographic core (Shamir, field math)
├── horcrux-holder # Distributed share holders (HTTP nodes)
├── horcrux-vault # Orchestrator (collect + reconstruct)
└── horcrux-cli # User interface (entry point)
- Rust (latest stable)
- Cargo
- (Optional) Docker
git clone https://github.com/AkZcH/horcrux.git
cd horcruxcargo build --workspaceUse your core logic to generate (k, n) shares.
Example:
secret = 123
k = 3
n = 5
Store resulting (x, y) values.
Run each holder in a separate terminal:
cargo run -p horcrux-holder -- <x> <y> <port>Example:
cargo run -p horcrux-holder -- 1 141 3001
cargo run -p horcrux-holder -- 2 500 3002
cargo run -p horcrux-holder -- 3 900 3003cargo run -p horcrux-cli -- \
--k 3 \
--epoch 0 \
--holders http://127.0.0.1:3001,http://127.0.0.1:3002,http://127.0.0.1:3003UNLOCK SUCCESS
hash: <hex-value>
shares_used: 3
If fewer than k nodes respond:
UNLOCK FAILED
reason: INSUFFICIENT_SHARES
docker-compose up --buildThis spins up:
- Multiple holders
- Vault service
- Secret is never printed, only hashed
- Holders are isolated and unaware of each other
- Reconstruction is transient (memory-only)
- No authentication
- No TLS (plaintext HTTP)
- No malicious node protection
- No persistent storage
- Naive share selection (first-k)
Run all tests:
cargo test --workspaceIncludes:
- Unit tests
- Property-based tests
- Integration tests
MIT License
MIT License
Copyright (c) 2026
Permission is hereby granted, free of charge, to any person obtaining a copy...
- Secure share refresh protocol
- Parallel request strategy in vault
- Authentication & TLS
- Persistent holder storage
- Kubernetes deployment
Akshat Chauhan
Star the repo. Fork it. Break it. Improve it.