secret-tree
allows deriving multiple secrets from a single seed value
in a secure and forward-compatible way.
The derivation procedure is hierarchical: a seed can be used to derive child seeds,
which have the same functionality as the original.
Add this to your Crate.toml
:
toml
[dependencies]
secret-tree = "0.5.0"
Basic usage:
```rust use secrettree::{SecretTree, Name}; use rand::{Rng, threadrng}; use secrecy::Secret;
let tree = SecretTree::new(&mut threadrng()); // Create 2 children from the tree: an ordinary secret // and a CSPRNG with a fixed seed. let secret: Secret<[u8; 32]> = tree .child(Name::new("secret")) .createsecret(); let othersecretrng = tree .child(Name::new("other_secret")) .rng(); ```
See crate documentation for more details how to use the crate.
Blake2b is used to derive secrets in a similar (and mostly compatible) way it is used for key derivation in [libsodium]. Derived CSPRNGs are based on the [ChaCha cipher], which has been extensively studied and has much smaller state size that alternatives (~160 bytes vs several kilobytes), limiting the threat of state leakage.
Crate documentation provides more implementation details.
Licensed under the Apache-2.0 license.