Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Telepathy Communications Library - <b>tp_crc16()</b> - compute xmodem-style crc http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   tp_crc16() - compute Xmodem-style CRC

   nCRC := tp_crc16(cString)

   cString     String to checksum.

   Returns     16-bit numeric CRC.

   Computes a 16-bit cyclic redundancy checksum (CRC) by the same
   algorithm used in Xmodem/CRC, Ymodem-1K, Ymodem and Ymodem-G, and
   Zmodem (when 32-bit CRCs are disabled).  The value returned is
   numeric, and should be converted to a string with i2bin() before you
   try to send it as data.

   If you append the CRC (after i2bin()) to the end of a string, then
   compute the CRC of the resulting string, you will get 0 if the CRC is
   correct.  That is,

       tp_crc16(string + i2bin(tp_crc16(string))) == 0

See Also: tp_crc32()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson