---
title: init()
framework: cryptokit
role: symbol
role_heading: Initializer
path: cryptokit/hashfunction/init()
---

# init()

Creates a hash function.

## Declaration

```swift
init()
```

## Discussion

Discussion Initialize a new hash function by calling this method if you want to hash the data iteratively, such as when you don’t have a buffer large enough to hold all the data at once. Provide data blocks to the hash function using the update(data:) or update(bufferPointer:) method. After providing all the data, call finalize() to get the digest. If your data fits into a single buffer, you can use the hash(data:) method instead to compute the digest in a single call.

## See Also

### Computing a hash iteratively

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