I'm using the PHP function below to calculate checksums for strings in PHP. The xor is required to produce the same value on 32 and 64 bit php platforms.
I would like to create a virtual field in MySQL select queries that will have the same value. SELECT ABS(CRC32(ui_data)) As checksum FROM user_data works but I don't know how to implement the if part in a SELECT statement to make it fully compatible to the PHP function.
10X
function checksum ($orig_id) {
$crc= abs (crc32($orig_id));
if( $crc & 0x80000000){
$crc ^= 0xffffffff;
$crc += 1;
}
return $crc;
}