<!--
{
  "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/Insecure/SHA1/init()",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Apple CryptoKit"
    ],
    "preciseIdentifier" : "s:9CryptoKit8InsecureO4SHA1VAEycfc"
  },
  "title" : "init()"
}
-->

# init()

Creates a SHA1 hash function.

```
init()
```

## 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:)`](/documentation/CryptoKit/Insecure/SHA1/update(bufferPointer:)) method. After providing all the data,
call [`finalize()`](/documentation/CryptoKit/Insecure/SHA1/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.

---

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)