1crc16(n)                   Cyclic Redundancy Checks                   crc16(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       crc16 - Perform a 16bit Cyclic Redundancy Check
9

SYNOPSIS

11       package require Tcl  8.2
12
13       package require crc16  ?1.1.1?
14
15       ::crc::crc16  ?-format format? ?-seed value? ?-implementation procname?
16       message
17
18       ::crc::crc16 ?-format format? ?-seed value? ?-implementation  procname?
19       -filename file
20
21       ::crc::crc-ccitt  ?-format format? ?-seed value? ?-implementation proc‐
22       name? message
23
24       ::crc::crc-ccitt ?-format format? ?-seed value? ?-implementation  proc‐
25       name? -filename file
26
27_________________________________________________________________
28

DESCRIPTION

30       This  package  provides a Tcl-only implementation of the CRC algorithms
31       based   upon   information    provided    at    http://www.microconsul
32       tants.com/tips/crc/crc.txt There are a number of permutations available
33       for calculating CRC checksums and this package can handle all of  them.
34       Defaults are set up for the most common cases.
35

COMMANDS

37       ::crc::crc16  ?-format format? ?-seed value? ?-implementation procname?
38       message
39
40       ::crc::crc16 ?-format format? ?-seed value? ?-implementation  procname?
41       -filename file
42
43       ::crc::crc-ccitt  ?-format format? ?-seed value? ?-implementation proc‐
44       name? message
45
46       ::crc::crc-ccitt ?-format format? ?-seed value? ?-implementation  proc‐
47       name? -filename file
48              The  command  takes  string  data  or  a file name and returns a
49              checksum value calculated using the CRC algorithm.  The  command
50              used  sets up the CRC polynomial, initial value and bit ordering
51              for the desired standard checksum  calculation.  The  result  is
52              formatted  using  the  format(n)  specifier  provided  or  as an
53              unsigned integer (%u) by default.
54

OPTIONS

56       -filename name
57              Return a checksum for the file contents instead of for parameter
58              data.
59
60       -format string
61              Return the checksum using an alternative format template.
62
63       -seed value
64              Select  an  alternative  seed value for the CRC calculation. The
65              default is 0 for the CRC16 calculation and 0xFFFF for the  CCITT
66              version.   This  can  be useful for calculating the CRC for data
67              structures without first converting the whole structure  into  a
68              string.  The  CRC of the previous member can be used as the seed
69              for calculating the CRC of the next member. It is also used  for
70              accumulating  a  checksum  from fragments of a large message (or
71              file)
72
73       -implementation procname
74              This hook is provided to allow users to provide their own imple‐
75              mentation  (perhaps a C compiled extension). The procedure spec‐
76              fied is called with two parameters. The first is the data to  be
77              checksummed  and  the  second  is  the seed value. An integer is
78              expected as the result.
79

EXAMPLES

81       % crc::crc16 "Hello, World!"
82       64077
83
84
85       % crc::crc-ccitt "Hello, World!"
86       26586
87
88
89       % crc::crc16 -format 0x%X "Hello, World!"
90       0xFA4D
91
92
93       % crc::crc16 -file crc16.tcl
94       51675
95
96

AUTHORS

98       Pat Thoyts
99

SEE ALSO

101       cksum(n), crc32(n), sum(n)
102

KEYWORDS

104       checksum, cksum, crc,  crc16,  crc32,  cyclic  redundancy  check,  data
105       integrity, security
106
108       Copyright (c) 2002, Pat Thoyts
109
110
111
112
113crc                                  1.1.1                            crc16(n)
Impressum