Jump to content

Why does one use CRC32?


2levelsabove

Recommended Posts

A co worker suggested that I store (ip address . session_id) and do a CRC32 and store that in database. (we are writing a tracking script.  Why is the logical reasoning of that ? Of course I know its a hash. However I am not sure how we would retreive that from database ?  And how would we even store it in MYSQL. I heard that it returns signed and unsigned based on operating system and the values could change. Why even use something like this?

 

 

Link to comment
Share on other sites

I see no reason to do it for an IP and a session_id. A crc is usually for chunks of data. You grab a chunk, crc it, send the data and the crc then the receiver gets the data and crc it then compares the crc's. If they match the data is ok. If they dont match the chunk is requested again. Its like an md5 for a file. but for it to do any good the sender of the data has to also send the crc otherwise its kind of useless.

 

Like I said, I see no reason when you can check the IP and the sesson_id from the client/cookie against what you have already stored.

 

 

HTH

Teamatomic

Link to comment
Share on other sites

There are two issues with that:

 

1) An alphanumeric hash is going to have more variation than a purely numeric hash, so it seems to me that an alphanumeric hash would be stronger. Though I am no security expert, so I could be wrong.

2) Why would you need to hash IP addresses in the first place?

Link to comment
Share on other sites

Both md5 and sha produce numbers. They're just usually represented as strings of hexadecimal DIGITS. Nothing stops you from setting second argument to true, which will give you actual binary output.

echo(md5(0,true));
'¤═ äĽŇe´fš▀¨¨çd┌'

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.