Skip to content

HASH8

Apply the xxHash64 (64-bit) hashing algorithm to a character string.

HASH8(input [, algorithm ])
string
Specify a character string that is the input to the function.
algorithm
Optionally, specify 0 for the algorithm (xxHash64, 64-bit). No other algorithm values are valid.

The return type of this function is BIGINT (INT8).

Examples

For example:

premdb=# select nickname, hash8(hash(nickname)) hashname from team where htid <10 order by nickname;
 nickname  |       hashname       
-----------+----------------------
 Blues     | -7564071997630541332
 Cherries  | -3383144761345514982
 Gunners   | -5149427805081569408
 Rovers    | -7647635251682027314
 Seasiders |  8780416543413982452
 Trotters  | -5729782585505407849
 Tykes     | -5365449622118805153
 Villains  |  4746666626073332151
(8 rows)
premdb=# select hash8('We are such stuff as dreams are made on') from sys.const;
       hash8        
---------------------
 6254556390689297124
(1 row)

Parent topic:String Functions