Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. # crc
  2. [![GitTip](http://img.shields.io/gittip/alexgorbatchev.svg?style=flat)](https://www.gittip.com/alexgorbatchev/)
  3. [![Dependency status](http://img.shields.io/david/alexgorbatchev/node-crc.svg?style=flat)](https://david-dm.org/alexgorbatchev/node-crc)
  4. [![devDependency Status](http://img.shields.io/david/dev/alexgorbatchev/node-crc.svg?style=flat)](https://david-dm.org/alexgorbatchev/node-crc?type=dev)
  5. [![Build Status](http://img.shields.io/travis/alexgorbatchev/node-crc.svg?style=flat&branch=master)](https://travis-ci.org/alexgorbatchev/node-crc)
  6. [![NPM](https://nodei.co/npm/crc.svg?style=flat)](https://npmjs.org/package/crc)
  7. Module for calculating Cyclic Redundancy Check (CRC) for Node.js and the Browser.
  8. # Important: Node >= 6.3.0 < 6.9.2
  9. There's was a bug in Node [#9342](https://github.com/nodejs/node/issues/9342) that affected CRC calculation if `Buffer.split()` is used (see issue discussion for details). This affected all version starting from `6.3.0` up to but not including `6.9.2`. The patch [#9341](https://github.com/nodejs/node/pull/9341) was released in `6.9.2`. If you are upgrading and seeing odd CRC calculation mismatches, this might be the reason.
  10. ## Features
  11. * Full test suite comparing values against reference `pycrc` implementation.
  12. * Pure JavaScript implementation, no dependencies.
  13. * Provides CRC tables for optimized calculations.
  14. * Provides support for the following CRC algorithms:
  15. * CRC1 `crc.crc1(…)`
  16. * CRC8 `crc.crc8(…)`
  17. * CRC8 1-Wire `crc.crc81wire(…)`
  18. * CRC16 `crc.crc16(…)`
  19. * CRC16 CCITT `crc.crc16ccitt(…)`
  20. * CRC16 Modbus `crc.crc16modbus(…)`
  21. * CRC16 Kermit `crc.crc16kermit(…)`
  22. * CRC16 XModem `crc.crc16xmodem(…)`
  23. * CRC24 `crc.crc24(…)`
  24. * CRC32 `crc.crc32(…)`
  25. ## Installation
  26. ```
  27. npm install crc
  28. ```
  29. ## Usage
  30. Calculate a CRC32:
  31. ```js
  32. var crc = require('crc');
  33. crc.crc32('hello').toString(16);
  34. // "3610a686"
  35. ```
  36. Calculate a CRC32 of a file:
  37. ```js
  38. crc.crc32(fs.readFileSync('README.md', 'utf8')).toString(16);
  39. // "127ad531"
  40. ```
  41. Or using a `Buffer`:
  42. ```js
  43. crc.crc32(fs.readFileSync('README.md')).toString(16);
  44. // "127ad531"
  45. ```
  46. Incrementally calculate a CRC32:
  47. ```js
  48. value = crc.crc32('one');
  49. value = crc.crc32('two', value);
  50. value = crc.crc32('three', value);
  51. value.toString(16);
  52. // "9e1c092"
  53. ```
  54. ## Running tests
  55. ```
  56. npm test
  57. ```
  58. ## Thanks!
  59. [pycrc](http://www.tty1.net/pycrc/) library is which the source of all of the CRC tables.
  60. # License
  61. The MIT License (MIT)
  62. Copyright (c) 2014 Alex Gorbatchev
  63. Permission is hereby granted, free of charge, to any person obtaining a copy
  64. of this software and associated documentation files (the "Software"), to deal
  65. in the Software without restriction, including without limitation the rights
  66. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  67. copies of the Software, and to permit persons to whom the Software is
  68. furnished to do so, subject to the following conditions:
  69. The above copyright notice and this permission notice shall be included in
  70. all copies or substantial portions of the Software.
  71. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  72. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  73. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  74. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  75. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  76. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  77. THE SOFTWARE.