---
title: finalize()
framework: cryptokit
role: symbol
role_heading: Instance Method
path: cryptokit/hashfunction/finalize()
---

# finalize()

Finalizes the hash function and returns the computed digest.

## Declaration

```swift
func finalize() -> Self.Digest
```

## Return Value

Return Value The computed digest of the data.

## Discussion

Discussion Call this method after you provide the hash function with all the data to hash using one or more calls to the update(data:) or update(bufferPointer:) method. After finalizing the hash function, discard it. To compute a new digest, create a new hash function with a call to the init() method.

## See Also

### Computing a hash iteratively

- [init()](cryptokit/hashfunction/init().md)
- [update(data:)](cryptokit/hashfunction/update(data:).md)
- [update(bufferPointer:)](cryptokit/hashfunction/update(bufferpointer:).md)
