Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Binary math and CRC32

Fun binary math / getting a CRC8

6:06 pm on Feb 1, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Apr 29, 2004
votes: 0

Does anyone know how to get a CRC8 out of PHP?

As I understand it a CRC8 has 4,294,967,296 possible answers. A CRC8 would have 256.

Related question:

I posted a message on the database board ( [webmasterworld.com...] ) about fun binary math in MySQL. The question is, if you have a site like last.fm, can you use binary sets to discover how users' band preferences inter-relate.

For example:
Jim likes 10010110
Jill likes 11010000
Bob likes 01000001

Ergo, Jim and Jill share bands one and four. Jim and Bob share no bands, and Bob and Jill share one.

Since this is a PHP question too, any ideas?

6:53 pm on Feb 1, 2006 (gmt 0)

New User

10+ Year Member

joined:Jan 31, 2006
votes: 0

My guess would be you'd have to explode it into an array,
$jil = explode("",$jilstring);
foreach($jil as $num=>$val) {
if($jil[$num] == $bob[$num])
Although you'd nee another loop in there somewhere. It would be a load easier if you could set preset choices. Then you could just query the DB for the right results.
2:56 pm on Feb 2, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 13, 2006
votes: 0

Why not save the binary digits into 8 different columns. Then you can let MySQL do the heavy lifting?

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members