⚠️ This package is a sub-package of the secret-toolkit
package. Please see its crate page for more context.
This crate contains common cryptography tools used in the development of Secret Contracts running on the Secret Network.
Note: It has a deep dependency tree and increases compilation times significantly.
Add the following to your cargo.toml
file:
toml
[dependencies]
secret-toolkit = { version = "0.7.0", features = ["crypto"] }
secret-toolkit-crypto = { version = "0.7.0", features = ["hash", "rand", "ecc-secp256k1"] }
```ignore
let entropy: String = "secret".toowned();
let prngseed: Vec
let mut rng = Prng::new(&prngseed, entropy.asbytes());
let privatekey: PrivateKey = PrivateKey::parse(&rng.randbytes())?; let publickey: PublicKey = privatekey.pubkey();
let message: &[u8] = b"message"; let signature: Signature = private_key.sign(message, deps.api);
```
["hash"]
- Provides an easy-to-use sha256
function. Uses sha2.["rand"]
- Used to generate pseudo-random numbers. Uses [randchacha] and [randcore].["ecc-secp256k1"]
- Contains types and methods for working with secp256k1 keys and signatures,
as well as standard constants for key sizes. Uses secp256k1.