Examples of CRYPT_HASH
x
with the SHA512 algorithmselect crypt_hash(x using sha512) from y;
CRYPT_HASH
x
with the SHA512 algorithmselect crypt_hash(x using sha512) from y;
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 BLOB
s of any length and character set.
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 USING
clause, or cryptographic hashes through [fblangref50-scalarfuncs-crypthash] — should be used for more reliable hashing.
The HASH
function returns BIGINT
for this algorithm
CRC32
With CRC32
, Firebird applies the CRC32 algorithm using the polynomial 0x04C11DB7.
The HASH
function returns INTEGER
for this algorithm.