MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / derive_key

Function derive_key

sodiumbox/src/lib.rs:59–65  ·  view source on GitHub ↗
(shared_secret: &[u8; 32])

Source from the content-addressed store, hash-verified

57/// Derives a symmetric key from the shared secret using HSalsa20.
58#[inline]
59fn derive_key(shared_secret: &[u8; 32]) -> [u8; 32] {
60 let hsalsa_nonce = [0u8; 16];
61 let key = salsa20::hsalsa::<U10>(shared_secret.into(), &hsalsa_nonce.into());
62 let mut result = [0u8; 32];
63 result.copy_from_slice(key.as_slice());
64 result
65}
66
67/// Creates a sealed box for a message using a recipient's public key.
68///

Callers 2

sealFunction · 0.70
open_sealed_boxFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected