| T X T _ P J W 6 4 H A S H ( )
| | | | | SOURCE: qdev_autodocs.txt 1.163 (12/09/2014) English
INDEP - TXT_#?
----------------------------------------------------------------------------
NAME
txt_pjw64hash() - Allows to hash any NULL term. string.
SYNOPSIS
hash = txt_pjw64hash(vuq, string);
ULONG txt_pjw64hash(VUQUAD *, UBYTE *);
FUNCTION
This function allows to hash a string using simplified
PJW routine extended to work on 64bit datatype. Thanks
to wider datatype this routine has very low repetition
rate.
INPUTS
vuq - Pointer to 64bit datatype. Can be NULL so the
only output will be lower 32 bits through the
'hash'.
string - NULL terminated string.
RETURNS
Returns 32bit or 64bit value or 0 if string is NULL.
BASES
None.
NOTES
This function should produce the very same values as
the 'mem_pjw64hash()' one.
Case insensitive version of this routine exists and
its called 'txt_pjw64ihash()'.
SEE ALSO
mem_pjw64hash()
EXAMPLE
...
UQUAD q;
VUQUAD vuq;
UBYTE buf[8];
ULONG hash;
UBYTE *data = "Hash me plenty!";
/*
* Use real QUAD datatype.
*/
txt_pjw64hash((VUQUAD *)&q, data);
printf("HASH = 0x%16qx\n", q);
/*
* Use virtual QUAD datatype.
*/
txt_pjw64hash(&vuq, data);
printf("HASH = 0x%08lx%08lx\n",
vuq.vuq_hi, vuq.vuq_lo);
/*
* Use some plain buffer.
*/
txt_pjw64hash((VUQUAD *)buf, data);
printf("HASH = 0x%08lx%08lx\n",
*(ULONG *)&buf[0], *(ULONG *)&buf[4]);
/*
* Obtain 32bit hash only.
*/
hash = txt_pjw64hash(NULL, data);
printf("HASH = 0x%08lx\n", hash);
...
BUGS
None known.
----------------------------------------------------------------------------
| |
| |