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

NAME

8       sum - Calculate a sum(1) compatible checksum
9

SYNOPSIS

11       package require Tcl  8.2
12
13       package require sum  ?1.1.0?
14
15       ::crc::sum  ?-bsd  | -sysv? ?-format fmt? ?-chunksize size? [ -filename
16       file | -channel chan | string ]
17
18_________________________________________________________________
19

DESCRIPTION

21       This package provides a Tcl-only implementation of the  sum(1)  command
22       which  calculates a 16 bit checksum value from the input data.  The BSD
23       sum algorithm is used by default but the SysV algorithm is also  availā€
24       able.
25

COMMANDS

27       ::crc::sum  ?-bsd  | -sysv? ?-format fmt? ?-chunksize size? [ -filename
28       file | -channel chan | string ]
29              The command takes string data or a file name or  a  channel  and
30              returns  a checksum value calculated using the sum(1) algorithm.
31              The result is formatted using the format(n)  specifier  provided
32              or as an unsigned integer (%u) by default.
33

OPTIONS

35       -sysv  The  SysV  algorithm is fairly naive. The byte values are summed
36              and any overflow is discarded. The lowest 16 bits  are  returned
37              as  the  checksum.   Input  with  the same content but different
38              ordering will give the same result.
39
40       -bsd   This algorithm is similar to the SysV version but includes a bit
41              rotation  step  which  provides a dependency on the order of the
42              data values.
43
44       -filename name
45              Return a checksum for the file contents instead of for parameter
46              data.
47
48       -channel chan
49              Return a checksum for the contents of the specified channel. The
50              channel must be open for reading and should  be  configured  for
51              binary translation. The channel will no be closed on completion.
52
53       -chunksize size
54              Set  the  block size used when reading data from either files or
55              channels. This value defaults to 4096.
56
57       -format string
58              Return the checksum using an alternative format template.
59

EXAMPLES

61       % crc::sum "Hello, World!"
62       37287
63
64
65       % crc::sum -format 0x%X "Hello, World!"
66       0x91A7
67
68
69       % crc::sum -file sum.tcl
70       13392
71
72

AUTHORS

74       Pat Thoyts
75

BUGS, IDEAS, FEEDBACK

77       This document, and the package it describes, will  undoubtedly  contain
78       bugs and other problems.  Please report such in the category crc of the
79       Tcllib  SF  Trackers  [http://sourceforge.net/tracker/?group_id=12883].
80       Please  also  report any ideas for enhancements you may have for either
81       package and/or documentation.
82

SEE ALSO

84       cksum(n), crc32(n), sum(1)
85

KEYWORDS

87       checksum, cksum, crc, crc32, cyclic redundancy check,  data  integrity,
88       security, sum
89
91       Copyright (c) 2002, Pat Thoyts <patthoyts@users.sourceforge.net>
92
93
94
95
96crc                                  1.1.0                              sum(n)
Impressum