FreenetIS
 All Classes Namespaces Functions Variables Pages
Static Public Member Functions | List of all members
variable_symbol Class Reference

Static Public Member Functions

static crc16 ($data)
 CRC-CCITT-16 algorithm for the polynomial 0x1021.
static make_variable_symbol ($member_id)
 This function can be used for generating variable symbols from member id.

Member Function Documentation

static variable_symbol::crc16 (   $data)
static

CRC-CCITT-16 algorithm for the polynomial 0x1021.

Tomas Dulik note: the algorithm is too nice to be true. The values it computes differ from the values returned by other calculators, e.g. http://zorc.breitbandkatze.de/crc.html

This function can be used for generating the payments variable symbol from member id. crc16 can check error bursts up to 16bits long, so if the member mistypes such a generated variable symbol, almost any possible error should be detected.

Author
Tomas Dulik, using http://us3.php.net/manual/en/function.crc32.php#86628
Parameters
$data16bit integer for which crc16 should be computed
Returns
16bit int value containing crc16
static variable_symbol::make_variable_symbol (   $member_id)
static

This function can be used for generating variable symbols from member id.

Author
Tomas Dulik
Parameters
integer$member_id
Returns
string containing concatenation of member_id and 5 digits of its crc16

The documentation for this class was generated from the following file: