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.

crc32.js 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /* crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */
  2. /* vim: set ts=2: */
  3. /*exported CRC32 */
  4. var CRC32;
  5. (function (factory) {
  6. /*jshint ignore:start */
  7. /*eslint-disable */
  8. if(typeof DO_NOT_EXPORT_CRC === 'undefined') {
  9. if('object' === typeof exports) {
  10. factory(exports);
  11. } else if ('function' === typeof define && define.amd) {
  12. define(function () {
  13. var module = {};
  14. factory(module);
  15. return module;
  16. });
  17. } else {
  18. factory(CRC32 = {});
  19. }
  20. } else {
  21. factory(CRC32 = {});
  22. }
  23. /*eslint-enable */
  24. /*jshint ignore:end */
  25. }(function(CRC32) {
  26. CRC32.version = '1.2.0';
  27. /* see perf/crc32table.js */
  28. /*global Int32Array */
  29. function signed_crc_table() {
  30. var c = 0, table = new Array(256);
  31. for(var n =0; n != 256; ++n){
  32. c = n;
  33. c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
  34. c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
  35. c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
  36. c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
  37. c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
  38. c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
  39. c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
  40. c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
  41. table[n] = c;
  42. }
  43. return typeof Int32Array !== 'undefined' ? new Int32Array(table) : table;
  44. }
  45. var T = signed_crc_table();
  46. function crc32_bstr(bstr, seed) {
  47. var C = seed ^ -1, L = bstr.length - 1;
  48. for(var i = 0; i < L;) {
  49. C = (C>>>8) ^ T[(C^bstr.charCodeAt(i++))&0xFF];
  50. C = (C>>>8) ^ T[(C^bstr.charCodeAt(i++))&0xFF];
  51. }
  52. if(i === L) C = (C>>>8) ^ T[(C ^ bstr.charCodeAt(i))&0xFF];
  53. return C ^ -1;
  54. }
  55. function crc32_buf(buf, seed) {
  56. if(buf.length > 10000) return crc32_buf_8(buf, seed);
  57. var C = seed ^ -1, L = buf.length - 3;
  58. for(var i = 0; i < L;) {
  59. C = (C>>>8) ^ T[(C^buf[i++])&0xFF];
  60. C = (C>>>8) ^ T[(C^buf[i++])&0xFF];
  61. C = (C>>>8) ^ T[(C^buf[i++])&0xFF];
  62. C = (C>>>8) ^ T[(C^buf[i++])&0xFF];
  63. }
  64. while(i < L+3) C = (C>>>8) ^ T[(C^buf[i++])&0xFF];
  65. return C ^ -1;
  66. }
  67. function crc32_buf_8(buf, seed) {
  68. var C = seed ^ -1, L = buf.length - 7;
  69. for(var i = 0; i < L;) {
  70. C = (C>>>8) ^ T[(C^buf[i++])&0xFF];
  71. C = (C>>>8) ^ T[(C^buf[i++])&0xFF];
  72. C = (C>>>8) ^ T[(C^buf[i++])&0xFF];
  73. C = (C>>>8) ^ T[(C^buf[i++])&0xFF];
  74. C = (C>>>8) ^ T[(C^buf[i++])&0xFF];
  75. C = (C>>>8) ^ T[(C^buf[i++])&0xFF];
  76. C = (C>>>8) ^ T[(C^buf[i++])&0xFF];
  77. C = (C>>>8) ^ T[(C^buf[i++])&0xFF];
  78. }
  79. while(i < L+7) C = (C>>>8) ^ T[(C^buf[i++])&0xFF];
  80. return C ^ -1;
  81. }
  82. function crc32_str(str, seed) {
  83. var C = seed ^ -1;
  84. for(var i = 0, L=str.length, c, d; i < L;) {
  85. c = str.charCodeAt(i++);
  86. if(c < 0x80) {
  87. C = (C>>>8) ^ T[(C ^ c)&0xFF];
  88. } else if(c < 0x800) {
  89. C = (C>>>8) ^ T[(C ^ (192|((c>>6)&31)))&0xFF];
  90. C = (C>>>8) ^ T[(C ^ (128|(c&63)))&0xFF];
  91. } else if(c >= 0xD800 && c < 0xE000) {
  92. c = (c&1023)+64; d = str.charCodeAt(i++)&1023;
  93. C = (C>>>8) ^ T[(C ^ (240|((c>>8)&7)))&0xFF];
  94. C = (C>>>8) ^ T[(C ^ (128|((c>>2)&63)))&0xFF];
  95. C = (C>>>8) ^ T[(C ^ (128|((d>>6)&15)|((c&3)<<4)))&0xFF];
  96. C = (C>>>8) ^ T[(C ^ (128|(d&63)))&0xFF];
  97. } else {
  98. C = (C>>>8) ^ T[(C ^ (224|((c>>12)&15)))&0xFF];
  99. C = (C>>>8) ^ T[(C ^ (128|((c>>6)&63)))&0xFF];
  100. C = (C>>>8) ^ T[(C ^ (128|(c&63)))&0xFF];
  101. }
  102. }
  103. return C ^ -1;
  104. }
  105. CRC32.table = T;
  106. // $FlowIgnore
  107. CRC32.bstr = crc32_bstr;
  108. // $FlowIgnore
  109. CRC32.buf = crc32_buf;
  110. // $FlowIgnore
  111. CRC32.str = crc32_str;
  112. }));