keyHash - Generate hash code for dictionary key - MATLAB (original) (raw)
Main Content
Generate hash code for dictionary key
Since R2022b
Syntax
Description
[h](#mw%5F49d0ebac-5e90-4624-80da-c40acd1b703c) = keyHash([A](#mw%5F293cfbf5-0df6-47c7-a61f-e1c6fed3bf15))
returns auint64
scalar that represents the input array, A
.
The keyHash
function generates a hash code based on the properties of the input. For custom classes keyHash
may need to be overloaded to ensure correct equivalence. For more information on using custom classes with dictionary, see Dictionaries and Custom Classes
Note
keyHash
uses a random seed. Results are not reproducible between MATLAB Sessions or across parallel workers.
Examples
Use keyHash
to create hash code for several arrays.
h =
uint64
15176618535206774870
h = keyHash(["monocycle" "bicycle" "tricycle"])
h =
uint64
680190522706874070
Input Arguments
Input array of dictionary keys, specified as an array.
Output Arguments
Hash code, specified as a uint64
scalar.
Version History
Introduced in R2022b