<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFHash(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@F@CFHash"
  },
  "title" : "CFHash(_:)"
}
-->

# CFHash(_:)

Returns a code that can be used to identify an object in a hashing structure.

```
func CFHash(_ cf: CFTypeRef!) -> CFHashCode
```

## Parameters

`cf`

A CFType object to examine.

## Return Value

An integer of type [`CFHashCode`](/documentation/CoreFoundation/CFHashCode) that represents a hashing value for `cf`.

## Discussion

Two objects that are equal (as determined by the [`CFEqual(_:_:)`](/documentation/CoreFoundation/CFEqual(_:_:)) function) have the same hashing value. However, the converse is not true: two objects with the same hashing value might not be equal. That is, hashing values are not necessarily unique.

The hashing value for an object might change from release to release or from platform to platform.

---

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)