Spec-Zone .ru
спецификации, руководства, описания, API
Spec-Zone .ru
спецификации, руководства, описания, API
Библиотека разработчика Mac Разработчик
Поиск

 

Эта страница руководства для  версии 10.9 Mac OS X

Если Вы выполняете различную версию  Mac OS X, просматриваете документацию локально:

Читать страницы руководства

Страницы руководства предназначаются как справочник для людей, уже понимающих технологию.

  • Чтобы изучить, как руководство организовано или узнать о синтаксисе команды, прочитайте страницу руководства для страниц справочника (5).

  • Для получения дополнительной информации об этой технологии, ищите другую документацию в Библиотеке Разработчика Apple.

  • Для получения общей информации о записи сценариев оболочки, считайте Shell, Пишущий сценарий Учебника для начинающих.



crc16(n)                                  Cyclic Redundancy Checks                                  crc16(n)



____________________________________________________________________________________________________________

NAME
       crc16 - Perform a 16bit Cyclic Redundancy Check

SYNOPSIS
       package require Tcl  8.2

       package require crc16  ?1.1.1?

       ::crc::crc16 ?-format format? ?-seed value? ?-implementation procname? message

       ::crc::crc16 ?-format format? ?-seed value? ?-implementation procname? -filename file

       ::crc::crc-ccitt ?-format format? ?-seed value? ?-implementation procname? message

       ::crc::crc-ccitt ?-format format? ?-seed value? ?-implementation procname? -filename file

       ::crc::xmodem ?-format format? ?-seed value? ?-implementation procname? message

       ::crc::xmodem ?-format format? ?-seed value? ?-implementation procname? -filename file

____________________________________________________________________________________________________________

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

COMMANDS
       ::crc::crc16 ?-format format? ?-seed value? ?-implementation procname? message

       ::crc::crc16 ?-format format? ?-seed value? ?-implementation procname? -filename file

       ::crc::crc-ccitt ?-format format? ?-seed value? ?-implementation procname? message

       ::crc::crc-ccitt ?-format format? ?-seed value? ?-implementation procname? -filename file

       ::crc::xmodem ?-format format? ?-seed value? ?-implementation procname? message

       ::crc::xmodem ?-format format? ?-seed value? ?-implementation procname? -filename file
              The command takes either string data or a file name and returns a  checksum  value  calculated
              using  the  CRC  algorithm. The command used sets up the CRC polynomial, initial value and bit
              ordering for the desired standard checksum calculation. The result is formatted using the for-mat(n) format(n)
              mat(n) specifier provided or as an unsigned integer (%u) by default.

              A number of common polynomials are in use with the CRC algorithm and the most commonly used of
              these are included in this package. For convenience each of these has a command alias  in  the
              crc namespace.

              It is possible to implement the CRC-32 checksum using this crc16 package as the implementation
              is sufficiently generic to extend to 32 bit checksums.  As  an  example  this  has  been  done
              already - however this is not the fastest method to implement this algorithm in Tcl and a sep-arate separate
              arate crc32 package is available.


OPTIONS
       -filename name
              Return a checksum for the file contents instead of for parameter data.

       -format string
              Return the checksum using an alternative format template.

       -seed value
              Select an alternative seed value for the CRC calculation. The default is 0 for the CRC16  cal-culation calculation
              culation  and  0xFFFF  for  the CCITT version.  This can be useful for calculating the CRC for
              data structures without first converting the whole structure into a string.  The  CRC  of  the
              previous member can be used as the seed for calculating the CRC of the next member. It is also
              used for accumulating a checksum from fragments of a large message (or file)

       -implementation procname
              This hook is provided to allow users to provide their own implementation (perhaps a C compiled
              extension).  The procedure specfied is called with two parameters. The first is the data to be
              checksummed and the second is the seed value. An integer is expected as the result.

              The package provides some implementations of standard CRC polynomials for  the  XMODEM,  CCITT
              and  the  usual  CRC-16 checksum. For convenience, additional commands have been provided that
              make use of these implementations.


EXAMPLES
       % crc::crc16 "Hello, World!"
       64077



       % crc::crc-ccitt "Hello, World!"
       26586



       % crc::crc16 -format 0x%X "Hello, World!"
       0xFA4D



       % crc::crc16 -file crc16.tcl
       51675


AUTHORS
       Pat Thoyts

BUGS, IDEAS, FEEDBACK
       This document, and the package it describes,  will  undoubtedly  contain  bugs  and  other  problems.
       Please   report   such   in   the   category   crc   of   the   Tcllib  SF  Trackers  [http://source -
       forge.net/tracker/? group_id=12883].  Please also report any ideas for enhancements you may  have  for
       either package and/or documentation.

SEE ALSO
       cksum(n), crc32(n), sum(n)

KEYWORDS
       checksum, cksum, crc, crc16, crc32, cyclic redundancy check, data integrity, security

CATEGORY
       Hashes, checksums, and encryption

COPYRIGHT
       Copyright (c) 2002, Pat Thoyts




crc                                                 1.1.1                                           crc16(n)

Сообщение о проблемах

Способ сообщить о проблеме с этой страницей руководства зависит от типа проблемы:

Ошибки содержания
Ошибки отчета в содержании этой документации со ссылками на отзыв ниже.
Отчеты об ошибках
Сообщите об ошибках в функциональности описанного инструмента или API через Генератор отчетов Ошибки.
Форматирование проблем
Отчет, форматирующий ошибки в интерактивной версии этих страниц со ссылками на отзыв ниже.