Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP CRC Function
Message
De
21/12/2012 15:18:03
Al Doman (En ligne)
M3 Enterprises Inc.
North Vancouver, Colombie Britannique, Canada
 
 
À
21/12/2012 15:03:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01560390
Message ID:
01560424
Vues:
56
The exact details of your use for it don't really matter. Ultimately, when hash functions are used, the purpose is to compare the resulting hashes to determine "same" or "different". With a high rate of collisions, CRC32 gives too many false positives i.e. reports "same" when really the underlying expressions are different. CRC32 is unreliable.

It's a bit ironic, because people usually start investigating hash functions because they've taken an interest in reliability or security. In those circumstances, using a known unreliable function, when better ones are readily available, is counterproductive.

>Its being used as a simple handshake check between 2 VFP applications. One of these applications is being rewritten in a different langauge and I was just looking at whether it would be easier to recode this function in the new language or whether to recode the SYS(2007) in the remaining VFP app to something else. Hence the collision thing is not an issue for the purpose to which it is being used.
>
>
>>I can't think of any valid use for that function. It's a poor choice to generate a hash, collisions are far too frequent e.g.
>>
>>?SYS( 2007, "plumless", 0, 1 )  &&1306201125
>>?SYS( 2007, "buckeroo", 0, 1 )  &&1306201125
>>
>>Much better to use something like MD5 or one of the SHA hash functions. MD5 is considered "broken" for hard cryptographic use but is good enough for most other purposes.
>>
>>http://preshing.com/20110504/hash-collision-probabilities
>>
>>>That's right Thomas :) I know how to use SYS(2007). I am thinking of trying to implement the function in another langauge if its not too much work.
>>>
>>>
>>>>Hmm,
>>>>
>>>>I thought Jos was after the code used to implement the vfp version OF sys(2007) to use perhaps in a another tier...
>>>>
>>>>Jooooos ?
>>>>
>>>>
>>>>
>>>>>ENTER IN THE COMMAND WINDOW
>>>>>HELP SYS(2007)
>>>>>
>>>>>I use it to compare 2 values to see if they no longer match. Such as when updating a remote MySQL database. No need to send the update over the wire if no changes where made. Note that I am leaving out the flags, etc here to simplify but you should get the idea.
>>>>>
>>>>>
nOrgCkVal =  SYS(2007,CustName)
>>>>>...user edits data here...
>>>>>before save
>>>>>if nOrgCkVal <> SYS(2007,CustName)
>>>>>  update the server cause the data has changed
>>>>>endif
>>>>>
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform