<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CryptoKit",
  "identifier" : "/documentation/CryptoKit/HashFunction/update(data:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Apple CryptoKit",
      "CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit12HashFunctionPAAE6update4datayqd___t10Foundation12DataProtocolRd__lF"
  },
  "title" : "update(data:)"
}
-->

# update(data:)

Incrementally updates the hash function with the given data.

```
mutating func update<D>(data: D) where D : DataProtocol
```

## Parameters

`data`

The next block of data for the ongoing digest calculation. You
can provide this as any type that conforms to
<doc://com.apple.documentation/documentation/Foundation/DataProtocol>,
like <doc://com.apple.documentation/documentation/Foundation/Data> or an
array of <doc://com.apple.documentation/documentation/Swift/UInt8>
instances.

## Discussion

Call this method one or more times to provide data to the hash function
in blocks. After providing the last block of data, call the
[`finalize()`](/documentation/CryptoKit/HashFunction/finalize()) method to get the computed digest. Don’t call the update
method again after finalizing the hash function.

---

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)