dictionary

Methods

Method Reference: dictionary.keyHash

dictionary: key = keyHash (d)

dictionary: key = keyHash (d, base)

Generate a hash code for a dictionary.

key = keyHash (d) returns a 64-bit hash code of the dictionary d as a uint64 scalar, from its key and value types and its entries in the order they were added, so that a dictionary can be a key of another. Unlike isequal, the code, and with it keyMatch, depends on the order of the entries and on the types, as in MATLAB. A dictionary whose keys or values keyHash cannot hash, such as tables, is refused.

key = keyHash (d, base) also generates a 64-bit hash code using base as the offset basis for the FNV-1a hash algorithm. base must be a uint64 integer type scalar. Use this syntax to cascade keyHash on multiple objects for which a single hash code is required.

Note that unlike MATLAB, this implementation does not use any random seed. As a result, keyHash will always generate the exact same hash key for any particular input across different workers and Octave sessions.

See also: keyHash, keyMatch, dictionary.isequal

Source Code: dictionary