HASH()
Non-cryptographic hash
INTEGER, BIGINT
HASH (value [USING <hash>]) <hash> ::= CRC32
| Parameter | Description | 
|---|---|
| value | Expression of value of any type;non-string or non-binary types are converted to string | 
| hash | Non-cryptographic hash algorithm to apply | 
HASH returns a hash value for the input argument.If the input argument is not a string or binary type, it is converted to string before hashing.
The optional USING clause specifies the non-cryptographic hash algorithm to apply.When the USING clause is absent, the legacy PJW algorithm is applied;this is identical to its behaviour in previous Firebird versions.
This function fully supports text BLOBs of any length and character set.
- not specified
- 
When no algorithm is specified, Firebird applies the 64-bit variant of the non-cryptographic PJW hash function (also known as ELF64).This is a fast algorithm for general purposes (hash tables, etc.), but its collision quality is suboptimal.Other hash functions — specified explicitly in the USINGclause, or cryptographic hashes through [fblangref50-scalarfuncs-crypthash] — should be used for more reliable hashing.The HASHfunction returnsBIGINTfor this algorithm
- CRC32
- 
With CRC32, Firebird applies the CRC32 algorithm using the polynomial 0x04C11DB7.The HASHfunction returnsINTEGERfor this algorithm.