---
title: finalize()
framework: swift
role: symbol
role_heading: Instance Method
path: swift/hasher/finalize()
---

# finalize()

Finalizes the hasher state and returns the hash value.

## Declaration

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

## Return Value

Return Value The hash value calculated by the hasher.

## Discussion

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.
