LRC - Perl interface for longitudinal redundancy check generation


String-LRC documentation  | view source Contained in the String-LRC distribution.

Index


NAME

Top

LRC - Perl interface for longitudinal redundancy check generation

SYNOPSIS

Top

    use String::LRC;
    $lrc = lrc("string to get lrc of");

DESCRIPTION

Top

The Longitudinal Redundancy Check (LRC) is a one byte character, commonly used as a byte-field in data transmission over analog systems.

Most commonly, in STX-ETX bounded strings sent in financial protocols. Following some previous experience with such protocols, I wrote an LRC function in perl and later decided to re-write in C for efficiency. The result is this module String::LRC, which generates this aforementioned byte.

EXAMPLES

Top

    use String::LRC;
    $lrc = lrc("string to get lrc of");

  Commonly used in financial protocols as follows with ETX (ASCII 03)
  appended to LRC sum and packets after the STX (ASCII 02), payload,
  and ETX chars.  

    use String::LRC;
    $outboundString = chr(02) . $outboundString . chr(03)
			. lrc($outboundString . chr(03));

You may also use String::LRC to get the LRC result of a file, following Soenke J. Peters' example for CRC32. However, LRCs are really best used for line-by-line parity.

    use String::LRC;
    open(TESTFILE, "/path/to/test.file");
    $lrc = lrc(*TESTFILE);
    close(TESTFILE);

A init value may also been supplied in the above example.

AUTHOR

Top

Ralph Padron <whoelse@elitedigital.net>

If you have any requests or bugs, send email to the above address (no spam please).

COPYRIGHT

Top

SEE ALSO OR RELATED

Top


String-LRC documentation  | view source Contained in the String-LRC distribution.