{"id":19933976,"url":"https://github.com/k4m4/hash-length-regex","last_synced_at":"2025-05-03T12:30:28.769Z","repository":{"id":42238421,"uuid":"134754575","full_name":"k4m4/hash-length-regex","owner":"k4m4","description":"Retrieve the regular expression of a hash of specified bit-length.","archived":false,"fork":false,"pushed_at":"2023-01-05T16:14:12.000Z","size":540,"stargazers_count":6,"open_issues_count":7,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T15:51:53.271Z","etag":null,"topics":["bit-length","hash","length","regex","regex-matcher"],"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/k4m4.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}},"created_at":"2018-05-24T18:32:36.000Z","updated_at":"2025-01-04T19:37:43.000Z","dependencies_parsed_at":"2023-02-04T06:45:40.271Z","dependency_job_id":null,"html_url":"https://github.com/k4m4/hash-length-regex","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k4m4%2Fhash-length-regex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k4m4%2Fhash-length-regex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k4m4%2Fhash-length-regex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k4m4%2Fhash-length-regex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/k4m4","download_url":"https://codeload.github.com/k4m4/hash-length-regex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252190438,"owners_count":21708881,"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":["bit-length","hash","length","regex","regex-matcher"],"created_at":"2024-11-12T23:15:29.419Z","updated_at":"2025-05-03T12:30:28.389Z","avatar_url":"https://github.com/k4m4.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hash-length-regex [![Build Status](https://travis-ci.org/k4m4/hash-length-regex.svg?branch=master)](https://travis-ci.org/k4m4/hash-length-regex) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo)\n\n\u003e Retrieve the regular expression of a hash of specified bit-length.\n\n\n## Install\n\n```\n~ ❯❯❯ npm install hash-length-regex\n```\n\n\n## Usage\n\n```js\nconst hashLengthRegex = require('hash-length-regex');\n\nhashLengthRegex(128).test('nodejsrocks 1abcb33beeb811dca15f0ac3e47b88d9');\n//=\u003e true\n\nhashLengthRegex(128, {exact: true}).test('nodejsrocks 1abcb33beeb811dca15f0ac3e47b88d9 foo');\n//=\u003e false\n\nhashLengthRegex(256, {exact: true}).test('4696a780a2051b5a0f422970904da794adc1b499b2f4583e778e100a0bdd79cc');\n//=\u003e true\n\n'nodejsrocks 1abcb33beeb811dca15f0ac3e47b88d9 rainbow 897b47d80a717715378832539b4c1340'.match(hashLengthRegex(128));\n//=\u003e ['1abcb33beeb811dca15f0ac3e47b88d9', '897b47d80a717715378832539b4c1340']\n```\n\n\n## API\n\n### hashLengthRegex (bitLength, [options])\n\nReturns a regular expression for matching hashes of the specified bit-length.\n\n#### bitLength\n\nType: `number`\n\nNumber of bits of desired hash.\n\n#### options\n\n##### options.exact\n\nType: `boolean`\nDefault: `false` *(Matches any hash in a string)*\n\nOnly match an exact string. Useful with `RegExp#test()` to check if a string is a hash of given bit-length.\n\n\n## License\n\nMIT © [Nikolaos Kamarinakis](https://nikolaskama.me)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk4m4%2Fhash-length-regex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fk4m4%2Fhash-length-regex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk4m4%2Fhash-length-regex/lists"}