Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hash() Function in VFP
Message
De
24/10/2002 01:03:39
 
 
À
21/10/2002 09:44:57
Lakhani Anil
Lakhani Software Solutions
Mumbai, Inde
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00713481
Message ID:
00714672
Vues:
66
>Hi All,
>
>How can we use Hash() Function in VFP, as we are using it in VB & Java to generate unique key from a name string?
>
>Anil Lakhani
* here is a 31 bit hash function, remember that hashes are not quaranteed to be
* unique

FUNCTION hash (tcString)
LOCAL i, lnHash, lcString

lnHash = 0

lcString = tcString + REPLICATE(CHR(0), 4)

FOR i = 1 TO LEN(tcString) STEP 4
	lnHash = BITCLEAR(BITXOR(lnHash, CTOBIN(SUBSTR(lcString, i, 4))), 31)
ENDFOR

RETURN lnHash
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform