{"id":18849149,"url":"https://github.com/kiplingw/node-rng","last_synced_at":"2026-02-02T18:30:16.241Z","repository":{"id":202282870,"uuid":"190091262","full_name":"kiplingw/node-rng","owner":"kiplingw","description":"C++ module for Node.js for high quality hardware random number generator via Intel Secure Key (Ivy Bridge) hardware.","archived":false,"fork":false,"pushed_at":"2019-06-03T22:32:26.000Z","size":138,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-30T14:49:12.552Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.charit.ee/","language":"C++","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/kiplingw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-06-03T22:31:26.000Z","updated_at":"2019-06-03T22:45:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"be79cb1f-4cbb-49dc-a300-8235aa087cdb","html_url":"https://github.com/kiplingw/node-rng","commit_stats":null,"previous_names":["kiplingw/node-rng"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiplingw%2Fnode-rng","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiplingw%2Fnode-rng/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiplingw%2Fnode-rng/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiplingw%2Fnode-rng/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kiplingw","download_url":"https://codeload.github.com/kiplingw/node-rng/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239786250,"owners_count":19696772,"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":[],"created_at":"2024-11-08T03:18:31.933Z","updated_at":"2026-02-02T18:30:16.149Z","avatar_url":"https://github.com/kiplingw.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-rng\n\nCopyright (C) 2016 Charit.ee Inc.\n\nA C++ module for node.js to provide access to a high quality hardware random\nnumber generator. At this time only the Intel Secure Key with Ivy Bridge\nhardware is supported.\n\n## Quick Usage\n\n```js\nvar rng = require(\"rng\");\n\nif(rng.isAvailable())\n{\n    var randomNumber    = rng.getRandom();\n    randomNumber        = rng.getRandomRange(-10, 10);\n\n    rng.getRandomAsync(function(result) {\n        console.log(result);\n    });\n\n    rng.getRandomRangeAsync(-10, 10, function(low, high, result) {\n        console.log(result);\n    });\n}\n```\n\n## API\n\n### isAvailable()\n\nReturns `true` if the hardware random number generator is available.\n\n### getCorrections()\n\nReturns the number of times the hardware detected a poor quality random number\nand corrected it before supplying the client. Repeated non-zero values can\nindicate a problem with the hardware.\n\n### getVersion()\n\nReturns the major, minor, and patch version of the module as a SemVer friendly\nstring.\n\n### getRandom()\n\nReturns an unsigned 32-bit random number in the interval of [0, 4,294,967,295]\nsynchronously.\n\n### getRandomAsync(function(error, result))\n\nCalls `function` with an unsigned 32-bit random number in the interval of\n[0, 4,294,967,295] asynchronously. The `error` field is `null` if no correction\nwas necessary before supplying a valid random number. Otherwise it will contain\nan error exception.\n\n### getRandomRange(lower, upper)\n\nReturns a signed 32-bit random number in the interval of ['lower', 'upper']\nsynchronously such that `lower` can be a minimum of -2,147,483,648 and `upper` a\nmaximum of 2,147,483,647.\n\n### getRandomRangeAsync(lower, upper, function(error, result))\n\nReturns a signed 32-bit random number to `function` asynchronously in the\ninterval of ['lower', 'upper'] asynchronously such that `lower` can be a minimum\nof -2,147,483,648 and `upper` a maximum of 2,147,483,647. The `error` field is\n`null` if no correction was necessary before supplying a valid random number.\nOtherwise it will contain an error exception.\n\n## Building\n\n### Building node.js\n\n* Official node.js debianized packages are either poorly packaged or woefully\n  out of date at best on my distro. At this time, must build from source.\n\n* Build node.js from source on a typical GNU system.\n```\n    $ wget https://nodejs.org/dist/v5.8.0/node-v5.8.0.tar.gz\n    $ tar xvzf node-v5.8.0.tar.gz\n    $ cd node-v5.8.0\n    $ ./configure --debug --prefix=$HOME/.local\n    $ make \u0026\u0026 make check \u0026\u0026 make install\n```\n\n* Add node-gyp to search path in ~/.bashrc, if you prefer\n```\n    # Add local node.js build...\n    if [ -e $HOME/.local/lib/node_modules/npm/bin/node-gyp-bin/node-gyp ] ; then\n        PATH=$HOME/.local/lib/node_modules/npm/bin/node-gyp-bin/:\"${PATH}\"\n    fi\n```\n\n### Building node-rng\n\n```\n    $ cd node-rng\n    $ node-gyp configure\n    $ node-gyp build\n```\n\n### Testing node-rng\n\n* General usage:\n```\n    $ node node-rng-example.js\n```\n\n* Statistical testing with dieharder: (note that this takes a long time)\n```\n    $ sudo apt-get install dieharder\n    $ node node-rng-test.js | dieharder -a -g 200\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiplingw%2Fnode-rng","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkiplingw%2Fnode-rng","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiplingw%2Fnode-rng/lists"}