I was calculating the LRC before setting even parity. I'm hoping that was my problem. If so, this is the change that I made, in case anyone else can find use in these functions:

/************* LRC ************************/
/*** taken from Perl module String::LRC ***/

function lrc($buffer)
{
    $len = 0;
    $buffer = setEvenParity($buffer);
    if (isset($buffer) && !empty($buffer)){
        $len = strlen($buffer);
    }
    $check = substr($buffer, 0, 1);
    for ($i = 1; $i < $len ; $i++) {
        $check ^= substr($buffer, $i, 1);
    }
    return $check;
}

We'll see how this goes tomorrow.

Dominic

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to