<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CryptoKit",
  "identifier" : "/documentation/CryptoKit/HKDF/extract(inputKeyMaterial:salt:)-4f5wf",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Apple CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit4HKDFV7extract16inputKeyMaterial4saltAA24HashedAuthenticationCodeVyxGAA09SymmetricF0V_qd__Sgt10Foundation12DataProtocolRd__lFZ"
  },
  "title" : "extract(inputKeyMaterial:salt:)"
}
-->

# extract(inputKeyMaterial:salt:)

Creates cryptographically strong key material from a main key or
passcode that you specify.

```
static func extract<Salt>(inputKeyMaterial: SymmetricKey, salt: Salt?) -> HashedAuthenticationCode<H> where Salt : DataProtocol
```

## Parameters

`inputKeyMaterial`

The main key or passcode the derivation function
uses to derive a key.

`salt`

The salt to use for key derivation.

## Return Value

A pseudorandom, cryptographically strong key in the form of a
hashed authentication code.

## Discussion

Generate a derived symmetric key from the cryptographically strong key
material this function creates by calling
[`expand(pseudoRandomKey:info:outputByteCount:)`](/documentation/CryptoKit/HKDF/expand(pseudoRandomKey:info:outputByteCount:)).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)