> Aztec.nr API reference, v6.0.0 (mainnet and testnet). Index: https://docs.aztec.network/aztec-nr-api/v6.0.0/llms.txt

# Function derive_ecdh_shared_secret

Module: `noir_aztec::keys::ecdh_shared_secret`

```rust
pub fn derive_ecdh_shared_secret(
    secret: EmbeddedCurveScalar,
    public_key: EmbeddedCurvePoint,
) -> EmbeddedCurvePoint
```

Computes a standard ECDH shared secret: secret \* public_key = shared_secret.

The input secret is known only to one party. The output shared secret can be derived given knowledge of `public_key`'s key-pair and the public ephemeral secret, using this same function (with reversed inputs).

E.g.: Epk = esk \* G // ephemeral key-pair Pk = sk \* G // recipient key-pair Shared secret S = esk \* Pk = sk \* Epk

See also: <https://en.wikipedia.org/wiki/Elliptic-curve_Diffie%E2%80%93Hellman>
