hash signature

Prev Next

Function Names

hash signature

Description

This function generates a hash value from the parameters supplied. The intention is to minimize coincidences of two different values resulting to the same hash signature value. Purposes: Fast matching of old vs. new data by just checking the signature values. Great effort has been put in to avoid or minimize colliding signatures, e.g. if two values sharing the same signature. As an example, 'ab' and 'ba' will luckily generate two different signatures. Any number of parameters of any type may be provided, e.g numbers, strings, dates, sets, etc.

Call as: function

Restrictions

Indirect parameter passing is disabled

Parameter count

Min 1

Parameters

No.TypeDescription
1
input
all types Contributing values

These values contribute to calculating the hash signature.

Return value

TypeDescription
numeral Hash signature

Values between 0 and 999999999 (max. 9 digits)

Examples

       echo( hash signature(0) );
       echo( hash signature('') );
       echo( hash signature(' ') );
       echo( hash signature(Hello World) );
       echo( hash signature(Hello world) );

Output

202308436
163212821
202234692
976078552
508617228
Try it yourself: Open LIB_Function_hash_signature.b4p in B4P_Examples.zip. Decompress before use.