Tuesday, November 07, 2006

What is CRC32 in php?

"A cyclic redundancy check (CRC) is a type of hash function used to produce a checksum - which is a small, fixed number of bits - against a block of data, such as a packet of network traffic or a block of a computer file."

<?php
$var = 'I like cheese dude!!';
$var = crc32($var);
echo $var;
?>

You can compare two encrypted variables too
<?php
$var2 = '1601738962';//I like cheese dude!!
$var = 'I like cheese dude!!';
$var = crc32($var);
if($var == $var2)
{
echo 'Variable 1 and Variable 2 Match';
}
else
{
echo 'Not mach';
}
?>

No comments: