{"id":15296151,"url":"https://github.com/richhaar/autosar-crc","last_synced_at":"2025-04-13T19:40:27.819Z","repository":{"id":42583828,"uuid":"420441443","full_name":"richhaar/autosar-crc","owner":"richhaar","description":"JavaScript NPM package for 8 bit, 16bit, 32bit and 64 bit CRC functions as specified by the AUTOSAR standard, written with C++","archived":false,"fork":false,"pushed_at":"2025-02-27T21:16:46.000Z","size":813,"stargazers_count":5,"open_issues_count":5,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T10:21:12.959Z","etag":null,"topics":["autosar","cpp","cpp17","crc","crc16","crc32","crc64","crc8","javascript","node-addon","node-addon-api","nodejs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/autosar-crc","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/richhaar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-10-23T14:53:44.000Z","updated_at":"2025-02-27T21:16:03.000Z","dependencies_parsed_at":"2024-10-15T01:21:06.637Z","dependency_job_id":"6712c6da-ac35-4b21-bfa7-1273bcd235d9","html_url":"https://github.com/richhaar/autosar-crc","commit_stats":{"total_commits":29,"total_committers":2,"mean_commits":14.5,"dds":0.06896551724137934,"last_synced_commit":"980cc26231cfedfeba0f67c1a19a06ba6d7d55ea"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richhaar%2Fautosar-crc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richhaar%2Fautosar-crc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richhaar%2Fautosar-crc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richhaar%2Fautosar-crc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/richhaar","download_url":"https://codeload.github.com/richhaar/autosar-crc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248770093,"owners_count":21158908,"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":["autosar","cpp","cpp17","crc","crc16","crc32","crc64","crc8","javascript","node-addon","node-addon-api","nodejs"],"created_at":"2024-09-30T18:09:35.339Z","updated_at":"2025-04-13T19:40:27.794Z","avatar_url":"https://github.com/richhaar.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AUTOSAR-CRC\n\nA C++ implemented set of 8,16,32,64 bit cyclic redundancy check (CRC) functions conforming to the CRC spec given by [AUTOSAR](https://www.autosar.org/). Written in C++ and compiled as a 'C++ addon' for use in JavaScript. Available on [NPM](https://www.npmjs.com/package/autosar-crc).\n\n## Getting Started\n\nThese instructions will get you up and running using the autosar-crc node module on your local machine.\n\n### Prerequisites\n\nTo get going you need the following installed:\n\n* NodeJS\n* npm\n* c++17 compiler\n\n### Installing\n\nAutosar-crc is available on the npm registry, so within your console you can install `autosar-crc`.\n\n```\nnpm install autosar-crc\n```\n\n### Different types of CRC\n\nAutosar-crc provides the following:\n\n```js example.js\nconst autocrc = require('autosar-crc');\n\nconsole.log(autocrc.crc8('123456789'));\nconsole.log(autocrc.crc8_h2f('123456789'));\nconsole.log(autocrc.crc16('123456789'));\nconsole.log(autocrc.crc32('123456789'));\nconsole.log(autocrc.crc32_p4('123456789'));\nconsole.log(autocrc.crc64('123456789'));\n\n```\n```\nnode example.js \n```\n\nYou should get the following result:\n\n```\n75\n223\n10673\n3421780262\n379048042\n11051210869376104000\n```\n\nThe polynomials of the CRC match the spec given in the AUTOSAR standard, see `crc_tables.h` for specifics on the polynomials.\n\nEach CRC accepts the following types:\n\n* `String`\n* `TypedArray`\n* `ArrayBuffer`\n\n```js\nconst autocrc = require('autosar-crc');\n\nconst arr = new Uint8Array([0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39]);\n\nconsole.log(autocrc.crc8(arr));\nconsole.log(autocrc.crc8(arr.buffer));\nconsole.log(autocrc.crc8('123456789'))\n\n```\n\nShould give you the following result (note: 0x31 is hex for 1):\n\n```\n75\n75\n75\n```\n\n## Benchmarks\n\nRunning crc32 over the entire works of Shakespeare 100x on a MacBook Air gives the following:\n\n```\nautosar-crc: 2.442s\ncrc: 3.293s\ncrc32: 56.973s\n```\n\n## Running the tests\n\nThe tests are found in the `main.test.js` file and are run with `Jest`.\n\n### Break down into end to end tests\n\nThe test script is defined in `package.json` so you can run:\n\n```\nnpm test\n```\n\n## Built With\n\n* [Node Addon API](https://github.com/nodejs/node-addon-api) - Module to use the Node-API from C++\n* [Jest](https://jestjs.io/) - Testing framework\n\n## Authors\n\n* **Richard Haar** - *Initial work* - [richhaar](https://github.com/richhaar)\n\n\u003c!--See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.--\u003e\n\n## License\n\nThis project is licensed under the ISC License - see the [LICENSE](https://github.com/richhaar/autosar-crc/blob/main/LICENSE) file for details\n\n## Acknowledgments\n\n* Bastian Molkenthin for the table generation [here](http://www.sunshine2k.de/coding/javascript/crc/crc_js.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frichhaar%2Fautosar-crc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frichhaar%2Fautosar-crc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frichhaar%2Fautosar-crc/lists"}