{"id":18486815,"url":"https://github.com/pierrec/js-xxhash","last_synced_at":"2025-04-08T19:34:01.839Z","repository":{"id":12875229,"uuid":"15551649","full_name":"pierrec/js-xxhash","owner":"pierrec","description":"Javascript implementation of xxHash","archived":true,"fork":false,"pushed_at":"2022-10-28T13:44:02.000Z","size":3998,"stargazers_count":289,"open_issues_count":7,"forks_count":34,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-10-28T03:35:01.072Z","etag":null,"topics":["javascript","js","xxhash"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/pierrec.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-31T14:58:51.000Z","updated_at":"2024-10-20T21:51:56.000Z","dependencies_parsed_at":"2022-08-26T07:01:15.566Z","dependency_job_id":null,"html_url":"https://github.com/pierrec/js-xxhash","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierrec%2Fjs-xxhash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierrec%2Fjs-xxhash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierrec%2Fjs-xxhash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierrec%2Fjs-xxhash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pierrec","download_url":"https://codeload.github.com/pierrec/js-xxhash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223343462,"owners_count":17129950,"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":["javascript","js","xxhash"],"created_at":"2024-11-06T12:49:50.946Z","updated_at":"2025-04-08T19:34:01.834Z","avatar_url":"https://github.com/pierrec.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Javascript implementation of xxHash\n\n## Synopsis\n\nxxHash is a very fast hashing algorithm (see the details [here](https://github.com/Cyan4973/xxHash)). xxhashjs is a Javascript implementation of it, written in 100% Javascript. Although not as fast as the C version, it does perform pretty well given the current Javascript limitations in handling unsigned 32 bits integers.\n\n\n## Installation\n\nIn nodejs:\n\n    npm install xxhashjs\n\nIn the browser, include the following, and access the constructor with _XXH_:\n\n```javascript\n\u003cscript src=\"/your/path/to/xxhash.js\"\u003e\u003c/script\u003e\n```\n\n\n## Examples\n\n* In one step:\n```javascript\nvar h = XXH.h32( 'abcd', 0xABCD ).toString(16)\t// seed = 0xABCD\n```\n\u003e 0xCDA8FAE4\n\n* In several steps (useful in conjunction of NodeJS streams):\n```javascript\nvar H = XXH.h32( 0xABCD )\t// seed = 0xABCD\nvar h = H.update( 'abcd' ).digest().toString(16)\n```\n\u003e 0xCDA8FAE4\n\n* More examples in the examples directory:\n\t* Compute xxHash from a file data\n\t* Use xxHashjs in the browser\n\n\n## Usage\n\n* XXH makes 2 functions available for 32 bits XXH and 64 bits XXH respectively, with the same signature:\n\n\t* XXH.h32\n\t* XXH.h64\n\n* In one step:\n`XXH.h32(\u003cdata\u003e, \u003cseed\u003e)`\nThe data can either be a string, an ArrayBuffer or a NodeJS Buffer object.\nThe seed can either be a number or a UINT32 object.\n\n* In several steps:\n\t* instantiate a new XXH object H:\n`XXH.h32(\u003cseed\u003e)` or `XXH.h32()`\nThe seed can be set later on with the `init` method\n\n\t* add data to the hash calculation:\n`H.update(\u003cdata\u003e)`\n\n\t* finish the calculations:\n`H.digest()`\n\nThe object returned can be converted to a string with `toString(\u003cradix\u003e)` or a number `toNumber()`.\nOnce `digest()` has been called, the object can be reused. The same seed will be used or it can be changed with `init(\u003cseed\u003e)`.\n\n\n## Methods\n\n* `XXH.h32()`\n\t* `.init(\u003cseed\u003e)`\n\tInitialize the XXH object with the given seed. The seed can either be a number or a UINT32 object.\n\t* `.update(\u003cdata\u003e)`\n\tAdd data for hashing. The data can either be a string, an ArrayBuffer or a NodeJS Buffer object.\n        * `digest()` (_UINT32_)\n\tFinalize the hash calculations and returns an UINT32 object. The hash value can be retrieved with toString(\u003cradix\u003e).\n\n* `XXH.h64()`\n\t* `.init(\u003cseed\u003e)`\n\tInitialize the XXH object with the given seed. The seed can either be a number or a UINT64 object.\n\t* `.update(\u003cdata\u003e)`\n\tAdd data for hashing. The data can either be a string, an ArrayBuffer or a NodeJS Buffer object.\n\t* `.digest()` (_UINT64_)\n\tFinalize the hash calculations and returns an UINT64 object. The hash value can be retrieved with toString(\u003cradix\u003e).\n\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpierrec%2Fjs-xxhash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpierrec%2Fjs-xxhash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpierrec%2Fjs-xxhash/lists"}