Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

43 lines
1.0 KiB

/*****************************************************************************
*
* hash.c
*
* Hashing tokens.
*
*****************************************************************************/
#include "m4.h"
/*****************************************************************************
*
* hashPtok
*
* Hash a token.
*
* For now, use some hash function.
*
*****************************************************************************/
HASH STDCALL
hashPtok(PCTOK ptok)
{
HASH hash = 0;
PTCH ptch;
for (ptch = ptchPtok(ptok); ptch < ptchMaxPtok(ptok); ptch++) {
hash += (hash << 1) + (hash >> 1) + *ptch;
}
return hash % g_hashMod;
}
/*****************************************************************************
*
* InitHash
*
*****************************************************************************/
void STDCALL
InitHash(void)
{
mphashpmac = pvAllocCb(g_hashMod * sizeof(PMAC));
bzero(mphashpmac, g_hashMod * sizeof(PMAC));
}