| M E M _ P J W 6 4 H A S H ( )
| | | | | SOURCE: qdev_autodocs.txt 1.163 (12/09/2014) English
INDEP - MEM_#?
----------------------------------------------------------------------------
NAME
mem_pjw64hash() - Allows to hash data in the memory.
SYNOPSIS
hash = mem_pjw64hash(vuq, memptr, memlen);
ULONG mem_pjw64hash(VUQUAD *, void *, LONG);
FUNCTION
This function allows to hash memory region using
simplified PJW routine extended to work on 64bit
datatype.
INPUTS
vuq - Pointer to 64bit datatype. Can be NULL so the
only output will be lower 32 bits through the
'hash'.
memptr - Data pointer.
memlen - Length of that data.
RETURNS
Returns 32bit or 64bit value or 0 if all the data is
0.
BASES
None.
NOTES
This function should produce the very same values as
the 'txt_pjw64hash()' one.
Important! Arg. in 'vuq' must generally be initialised
to 0 before passing!
SEE ALSO
txt_pjw64hash(), mem_fnv64hash()
EXAMPLE
/*
* Example on how to compute the checksum.
*/
...
VUQUAD vuq;
UBYTE buffer[256];
LONG readlen;
LONG fd;
vuq.vuq_hi = 0;
vuq.vuq_lo = 0;
if ((fd = Open("ram:disk.info", MODE_OLDFILE)))
{
while ((readlen = Read(fd, buffer, 256)))
{
mem_pjw64hash(&vuq, buffer, readlen);
}
Close(fd);
}
FPrintf(Output(), "CSUM = 0x%08lx%08lx\n",
vuq.vuq_hi, vuq.vuq_lo);
...
BUGS
None known.
----------------------------------------------------------------------------
| |
| |