{"id":15449348,"url":"https://github.com/orvn/crc32-js","last_synced_at":"2026-01-20T04:02:03.702Z","repository":{"id":164911349,"uuid":"636963379","full_name":"orvn/crc32-js","owner":"orvn","description":"A JS CRC32 and CRC16 checksum implementation that matches C and PHP","archived":false,"fork":false,"pushed_at":"2023-08-07T23:57:05.000Z","size":748,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-05T03:56:26.915Z","etag":null,"topics":["checksum","hash","hashing-algorithm"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/orvn.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":"2023-05-06T05:09:12.000Z","updated_at":"2024-02-11T04:39:56.000Z","dependencies_parsed_at":"2023-08-08T00:08:42.486Z","dependency_job_id":null,"html_url":"https://github.com/orvn/crc32-js","commit_stats":{"total_commits":36,"total_committers":2,"mean_commits":18.0,"dds":0.02777777777777779,"last_synced_commit":"650651ecd5451d8c45aa59d91f2cd24d9f514015"},"previous_names":["orvn/crc32-js","orvn/js-crc32"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/orvn/crc32-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orvn%2Fcrc32-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orvn%2Fcrc32-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orvn%2Fcrc32-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orvn%2Fcrc32-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orvn","download_url":"https://codeload.github.com/orvn/crc32-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orvn%2Fcrc32-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28595319,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T02:08:49.799Z","status":"ssl_error","status_checked_at":"2026-01-20T02:08:44.148Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["checksum","hash","hashing-algorithm"],"created_at":"2024-10-01T20:48:58.300Z","updated_at":"2026-01-20T04:02:03.682Z","avatar_url":"https://github.com/orvn.png","language":"JavaScript","readme":"# CRC32 (and CRC16) in JS\n\n\u003cimg src=\"/assets/images/graph-image.png\" alt=\"package graph image\" width=\"500\"\u003e\n\nA better Javascript CRC checksum or hashing implementation that yields the same result as C and PHP CRC functions.\n\n\n## Purpose\n\nThis package was created because other JavaScript CRC functions either tend to be inefficient, or don't match the CRC function output from implementations in C, or in PHP.\n\nIncluded is a 32-bit and a 16-bit CRC (cyclic redundancy checksum) function. This function is often used to check for data integregity. It can also be used as a concise hash, however there are some chances for collision at scale.\n\n\n## Usage\n\nAfter installing and importing the package (npm and yarn entries coming soon), it can be used as follows\n\n```js\ncrc32(str, [usePolynomialDivision], [format])\n```\n\nInclude a string to hash, and optionally elect to use polynomial division, which is set to `false` by default. Instead of polynomial division, the default is to use a pre-calculated lookup table, which is faster. This is also the implementation strategy used within the C and PHP source code.\n\nThe last option defaults to `true`, making the output a hexadecimal value. If set to `false` the output will be in decimal format.\n\n\n## Collision resistance\n\nCRC32 might be attractive as a hashing function because of its concise nature. However, collisions _should_ be expected at scale. For this reason it can be used as a hashing function at small scale, or as an effective checksum function.\n\nAt first it might seem that the chance of collision is low, because CRC32 results in fixed length 32-bit values. However, the birthday paradox should be considered when checking for the probability of collision between any two values, as a set grows.\n\n### $`P = 1 - \\frac{k!}{k^n (k-n)!}`$\n\nwhere \n- `n` is the size of the set\n- `k` is the total number of possible hashes in the algorithm (2^32)\n- `P` is the probability of a collision\n\nApplying this, if we have a set size of 1000 different strings, the probability of a collision between two of them is `0.01164%`, or `1 in 8600`. Clearly, this is a good function for checksums, but not an ideal function for most applications of hash functions.\n\n\n## Roadmap\n\nOther features that are coming soon include the following:\n\n- Argument to toggle between CRC32a and CRC32b\n- CRC16 implementation (currently incomplete)\n- Docs that explain how CRC32 works in more detail\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forvn%2Fcrc32-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forvn%2Fcrc32-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forvn%2Fcrc32-js/lists"}