Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. # crc32
  2. Standard CRC-32 algorithm implementation in JS (for the browser and nodejs).
  3. Emphasis on correctness, performance, and IE6+ support.
  4. ## Installation
  5. With [npm](https://www.npmjs.org/package/crc-32):
  6. ```bash
  7. $ npm install crc-32
  8. ```
  9. In the browser:
  10. ```html
  11. <script src="crc32.js"></script>
  12. ```
  13. The browser exposes a variable `CRC32`.
  14. When installed globally, npm installs a script `crc32` that computes the
  15. checksum for a specified file or standard input.
  16. The script will manipulate `module.exports` if available . This is not always
  17. desirable. To prevent the behavior, define `DO_NOT_EXPORT_CRC`.
  18. ## Usage
  19. In all cases, the relevant function takes an argument representing data and an
  20. optional second argument representing the starting "seed" (for rolling CRC).
  21. The return value is a signed 32-bit integer.
  22. - `CRC32.buf(byte array or buffer[, seed])` assumes the argument is a sequence
  23. of 8-bit unsigned integers (nodejs `Buffer`, `Uint8Array` or array of bytes).
  24. - `CRC32.bstr(binary string[, seed])` assumes the argument is a binary string
  25. where byte `i` is the low byte of the UCS-2 char: `str.charCodeAt(i) & 0xFF`
  26. - `CRC32.str(string[, seed])` assumes the argument is a standard JS string and
  27. calculates the hash of the UTF-8 encoding.
  28. For example:
  29. ```js
  30. // var CRC32 = require('crc-32'); // uncomment this line if in node
  31. CRC32.str("SheetJS") // -1647298270
  32. CRC32.bstr("SheetJS") // -1647298270
  33. CRC32.buf([ 83, 104, 101, 101, 116, 74, 83 ]) // -1647298270
  34. crc32 = CRC32.buf([83, 104]) // -1826163454 "Sh"
  35. crc32 = CRC32.str("eet", crc32) // 1191034598 "Sheet"
  36. CRC32.bstr("JS", crc32) // -1647298270 "SheetJS"
  37. [CRC32.str("\u2603"), CRC32.str("\u0003")] // [ -1743909036, 1259060791 ]
  38. [CRC32.bstr("\u2603"), CRC32.bstr("\u0003")] // [ 1259060791, 1259060791 ]
  39. [CRC32.buf([0x2603]), CRC32.buf([0x0003])] // [ 1259060791, 1259060791 ]
  40. ```
  41. ## Testing
  42. `make test` will run the nodejs-based test.
  43. To run the in-browser tests, run a local server and go to the `ctest` directory.
  44. `make ctestserv` will start a python `SimpleHTTPServer` server on port 8000.
  45. To update the browser artifacts, run `make ctest`.
  46. To generate the bits file, use the `crc32` function from python `zlib`:
  47. ```python
  48. >>> from zlib import crc32
  49. >>> x="foo bar baz٪☃🍣"
  50. >>> crc32(x)
  51. 1531648243
  52. >>> crc32(x+x)
  53. -218791105
  54. >>> crc32(x+x+x)
  55. 1834240887
  56. ```
  57. The included `crc32.njs` script can process files or standard input:
  58. ```bash
  59. $ echo "this is a test" > t.txt
  60. $ bin/crc32.njs t.txt
  61. 1912935186
  62. ```
  63. For comparison, the included `crc32.py` script uses python `zlib`:
  64. ```bash
  65. $ bin/crc32.py t.txt
  66. 1912935186
  67. ```
  68. On OSX the command `cksum` generates unsigned CRC-32 with Algorithm 3:
  69. ```bash
  70. $ cksum -o 3 < IE8.Win7.For.Windows.VMware.zip
  71. 1891069052 4161613172
  72. $ crc32 --unsigned ~/Downloads/IE8.Win7.For.Windows.VMware.zip
  73. 1891069052
  74. ```
  75. ## Performance
  76. `make perf` will run algorithmic performance tests (which should justify certain
  77. decisions in the code).
  78. The [`adler-32` project](http://git.io/adler32) has more performance notes
  79. ## License
  80. Please consult the attached LICENSE file for details. All rights not explicitly
  81. granted by the Apache 2.0 license are reserved by the Original Author.
  82. ## Badges
  83. [![Sauce Test Status](https://saucelabs.com/browser-matrix/crc32.svg)](https://saucelabs.com/u/crc32)
  84. [![Build Status](https://travis-ci.org/SheetJS/js-crc32.svg?branch=master)](https://travis-ci.org/SheetJS/js-crc32)
  85. [![Coverage Status](http://img.shields.io/coveralls/SheetJS/js-crc32/master.svg)](https://coveralls.io/r/SheetJS/js-crc32?branch=master)
  86. [![Dependencies Status](https://david-dm.org/sheetjs/js-crc32/status.svg)](https://david-dm.org/sheetjs/js-crc32)
  87. [![NPM Downloads](https://img.shields.io/npm/dt/crc-32.svg)](https://npmjs.org/package/crc-32)
  88. [![ghit.me](https://ghit.me/badge.svg?repo=sheetjs/js-xlsx)](https://ghit.me/repo/sheetjs/js-xlsx)
  89. [![Analytics](https://ga-beacon.appspot.com/UA-36810333-1/SheetJS/js-crc32?pixel)](https://github.com/SheetJS/js-crc32)