{"id":21747478,"url":"https://github.com/charlespascoe/hbprng","last_synced_at":"2026-05-13T20:32:17.696Z","repository":{"id":57261912,"uuid":"103911922","full_name":"charlespascoe/hbprng","owner":"charlespascoe","description":"Hash-Base Pseudo-Random Number Generator","archived":false,"fork":false,"pushed_at":"2017-09-21T11:26:35.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2026-01-30T09:24:58.930Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/charlespascoe.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":"2017-09-18T08:17:09.000Z","updated_at":"2017-09-19T12:27:35.000Z","dependencies_parsed_at":"2022-08-25T06:11:01.480Z","dependency_job_id":null,"html_url":"https://github.com/charlespascoe/hbprng","commit_stats":null,"previous_names":["cpascoe95/hbprng"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/charlespascoe/hbprng","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlespascoe%2Fhbprng","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlespascoe%2Fhbprng/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlespascoe%2Fhbprng/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlespascoe%2Fhbprng/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/charlespascoe","download_url":"https://codeload.github.com/charlespascoe/hbprng/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlespascoe%2Fhbprng/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32999232,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"ssl_error","status_checked_at":"2026-05-13T13:14:51.610Z","response_time":115,"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":[],"created_at":"2024-11-26T08:09:16.706Z","updated_at":"2026-05-13T20:32:17.676Z","avatar_url":"https://github.com/charlespascoe.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hash-Based Pseudo-Random Number Generator\n\nA deterministic number generator based on cryptographic hashing algorithms, with TypeScript typings.\n\n## Installation\n\n`$ npm install hbprng`\n\n## Usage\n\n```ts\nimport { Hbprng } from 'hbprng';\n\nlet generator = new Hbprng(Buffer.from('seed', 'utf8'), 'sha512');\n\nconsole.log(generator.nextInt());\nconsole.log(generator.nextInt());\nconsole.log(generator.nextInt());\n\n// Output:\n// 3242175261\n// 539230564\n// 526738857\n```\n\n## Hbprng Class API\n\n### constructor(seed: Buffer, [hashAlg: string = 'sha256'])\n\n- `seed`: a `Buffer` used to initialise the number generator\n- `hashAlg`: a `string` representing the hashing algorithm used to derive the sequence. Defaults to `sha256`. Please see the [Node Crypto Docs](https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm_options) for more information on available hashing algorithms.\n\nGiven the same `seed` and `hashAlg`, the generator will produce the same sequence.\n\n### nextByte(): number\n\nReturns the next byte from the sequence.\n\n### nextInt(): number\n\nReturns the next 32-bit unsigned integer from the sequence. Note that this method moves 4 bytes along the sequence.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharlespascoe%2Fhbprng","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcharlespascoe%2Fhbprng","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharlespascoe%2Fhbprng/lists"}