Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP CRC Function
Message
From
21/12/2012 15:35:16
 
 
To
21/12/2012 15:18:03
Al Doman (Online)
M3 Enterprises Inc.
North Vancouver, British Columbia, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01560390
Message ID:
01560427
Views:
53
Sorry Al but the exact details of my use in this case do matter. I am not using this function for cryptographic hashing or as a security function, for which I use proper hash algorithms as you suggest. I am using SYS(2007) for a different purpose and the collision issue is not relevant.

UPDATE: For crypto requirements I use Chilkat Crypto library which are extensive in their coverage and work very well with VFP - http://www.chilkatsoft.com/crypt-activex.asp


>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
>>>>>>
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform