<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/Hasher/finalize()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s6HasherV8finalizeSiyF"
  },
  "title" : "finalize()"
}
-->

# finalize()

Finalizes the hasher state and returns the hash value.

```
func finalize() -> Int
```

## Return Value

The hash value calculated by the hasher.

## Discussion

Finalizing consumes the hasher: it is illegal to finalize a hasher you
don’t own, or to perform operations on a finalized hasher. (These may
become compile-time errors in the future.)

Hash values are not guaranteed to be equal across different executions of
your program. Do not save hash values to use during a future execution.

---

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)