{"id":19534039,"url":"https://github.com/foxglove/crc","last_synced_at":"2025-04-26T14:34:36.696Z","repository":{"id":37073181,"uuid":"409740645","full_name":"foxglove/crc","owner":"foxglove","description":"Fast CRC32 computation in TypeScript","archived":false,"fork":false,"pushed_at":"2025-04-01T21:47:32.000Z","size":568,"stargazers_count":7,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-19T11:11:49.768Z","etag":null,"topics":["crc","crc32","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/foxglove.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-23T20:52:36.000Z","updated_at":"2025-04-01T21:47:34.000Z","dependencies_parsed_at":"2024-01-22T05:29:59.043Z","dependency_job_id":"338c68c6-c365-4ca2-8042-5a8ca9a3591f","html_url":"https://github.com/foxglove/crc","commit_stats":{"total_commits":128,"total_committers":3,"mean_commits":"42.666666666666664","dds":0.109375,"last_synced_commit":"47a8bfd2c399ee4b5327e9d7201bc5cf25b0f437"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":"foxglove/template-typescript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxglove%2Fcrc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxglove%2Fcrc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxglove%2Fcrc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxglove%2Fcrc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foxglove","download_url":"https://codeload.github.com/foxglove/crc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251001271,"owners_count":21520918,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crc","crc32","typescript"],"created_at":"2024-11-11T02:12:04.151Z","updated_at":"2025-04-26T14:34:36.290Z","avatar_url":"https://github.com/foxglove.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @foxglove/crc\n\nFast CRC32 computation in TypeScript\n\n[![npm version](https://img.shields.io/npm/v/@foxglove/crc)](https://www.npmjs.com/package/@foxglove/crc) ![](https://img.shields.io/badge/dependencies-0-green)\n\n## Introduction\n\nA [Cyclic Redundancy Check](https://en.wikipedia.org/wiki/Cyclic_redundancy_check) (CRC) is a calculation used to detect errors in data transmission.\n\nThis library implements **CRC32**, the standard 32-bit CRC using the binary polynomial `0xEDB88320`. This is the same algorithm used in [PNG](https://www.w3.org/TR/2003/REC-PNG-20031110/#D-CRCAppendix), [zlib](https://refspecs.linuxbase.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/zlib-crc32-1.html), and other popular applications.\n\n## Interface\n\nThe following functions are exported from this package:\n\n```ts\nfunction crc32Init(): number;\nfunction crc32Update(prev: number, data: ArrayBufferView): number;\nfunction crc32Final(prev: number): number;\n\nfunction crc32(data: ArrayBufferView): number;\n```\n\nNote: Since the CRC algorithm works with unsigned data, the `crc32` and `crc32Final` functions always return **non-negative** numbers. For example, CRC32(0x01) returns 2768625435 rather than -1526341861.\n\n## Usage\n\n```ts\nimport { crc32 } from \"@foxglove/crc\";\n\nconst data = new Uint8Array(...);\n\nconst crc = crc32(data);\n```\n\n```ts\nimport { crc32Init, crc32Update, crc32Final } from \"@foxglove/crc\";\n\nlet crc = crc32Init();\nwhile (/* more data available */) {\n  crc = crc32Update(crc, data);\n}\ncrc = crc32Final(crc);\n```\n\n## Benchmarks\n\nThis package achieves a \u003e5x performance improvement over many other CRC packages, because of the multi-byte algorithms used (adapted from https://github.com/komrad36/CRC).\n\nThe following benchmarks were recorded on a MacBook Pro with an M1 Pro chip and 16GB of RAM. Each iteration (\"op\") is processing 1MB of data.\n\n```\n$ yarn bench\n...\n  crc:\n    355 ops/s, ±0.56%     | 81.52% slower\n\n  node-crc:\n    376 ops/s, ±0.14%     | 80.43% slower\n\n  crc-32:\n    1 057 ops/s, ±0.16%   | 44.98% slower\n\n  polycrc:\n    327 ops/s, ±0.21%     | slowest, 82.98% slower\n\n  this package:\n    1 921 ops/s, ±0.18%   | fastest\n```\n\n## References\n\nFor further information about CRCs and their computation, see:\n\n- https://en.wikipedia.org/wiki/Computation_of_cyclic_redundancy_checks\n- https://github.com/komrad36/CRC\n- https://create.stephan-brumme.com/crc32/\n- https://zlib.net/crc_v3.txt\n- https://github.com/Michaelangel007/crc32\n- https://docs.microsoft.com/en-us/openspecs/office_protocols/ms-abs/06966aa2-70da-4bf9-8448-3355f277cd77\n\n## License\n\n@foxglove/crc is licensed under the [MIT License](https://opensource.org/licenses/MIT).\n\n## Releasing\n\n1. Run `yarn version --[major|minor|patch]` to bump version\n2. Run `git push \u0026\u0026 git push --tags` to push new tag\n3. GitHub Actions will take care of the rest\n\n## Stay in touch\n\nJoin our [Slack channel](https://foxglove.dev/slack) to ask questions, share feedback, and stay up to date on what our team is working on.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxglove%2Fcrc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoxglove%2Fcrc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxglove%2Fcrc/lists"}