- Qt 6.9
- Qt Core
- C++ Classes
- QHash
- Qt 6.9.3 Reference Documentation

# Obsolete Members for QHash

The following members of class QHash are deprecated. They are provided to keep old source code working. We strongly advise against using them in new code.

## Related Non-Members

`(deprecated in 6.6)` int | qGlobalQHashSeed()
`(deprecated in 6.6)` void | qSetGlobalQHashSeed(int newSeed)

## Related Non-Members

### `[deprecated in 6.6]` int qGlobalQHashSeed()

This function is deprecated since 6.6. We strongly advise against using it in new code.

Use QHashSeed::globalSeed() instead.

Returns the current global QHash seed.

The seed is set in any newly created QHash. See qHash about how this seed is being used by QHash.

See also QHashSeed and QHashSeed::globalSeed().

### `[deprecated in 6.6]` void qSetGlobalQHashSeed(int newSeed)

This function is deprecated since 6.6. We strongly advise against using it in new code.

Use QHashSeed instead.

Sets the global QHash seed to newSeed.

Manually setting the global QHash seed value should be done only for testing and debugging purposes, when deterministic and reproducible behavior on a QHash is needed. We discourage to do it in production code as it can make your application susceptible to algorithmic complexity attacks.

From Qt 5.10 and onwards, the only allowed values are 0 and -1. Passing the value -1 will reinitialize the global QHash seed to a random value, while the value of 0 is used to request a stable algorithm for C++ primitive types types (like `int`) and string types (QString, QByteArray).

The seed is set in any newly created QHash. See qHash about how this seed is being used by QHash.

If the environment variable `QT_HASH_SEED` is set, calling this function will result in a no-op.

See also QHashSeed::globalSeed() and QHashSeed.