{"id":16386390,"url":"https://github.com/tmcw/entropy","last_synced_at":"2026-02-27T14:35:55.822Z","repository":{"id":11236578,"uuid":"13631114","full_name":"tmcw/entropy","owner":"tmcw","description":"research into random","archived":false,"fork":false,"pushed_at":"2014-04-21T02:06:46.000Z","size":132,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-20T14:57:09.331Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tmcw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-16T20:57:23.000Z","updated_at":"2015-08-26T11:19:12.000Z","dependencies_parsed_at":"2022-07-12T15:04:12.633Z","dependency_job_id":null,"html_url":"https://github.com/tmcw/entropy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tmcw/entropy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmcw%2Fentropy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmcw%2Fentropy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmcw%2Fentropy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmcw%2Fentropy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmcw","download_url":"https://codeload.github.com/tmcw/entropy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmcw%2Fentropy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29899923,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T14:30:36.354Z","status":"ssl_error","status_checked_at":"2026-02-27T14:30:01.989Z","response_time":57,"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-10-11T04:17:08.724Z","updated_at":"2026-02-27T14:35:55.781Z","avatar_url":"https://github.com/tmcw.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"entropy\n=======\n\n## Cosmic Background Radiation\n\n\u003e but i think if you just make a microwave-band, put it in a parabolic reflector, and point it at the sky, some significant portion of the noise will be cosmic background - celoyd\n\n* [Geiger Counter tubes](http://www.ebay.com/itm/Geiger-Muller-tube-counter-SI3BG-NEW-lot-of-10-tubes-/251278027433?pt=BI_Security_Fire_Protection\u0026hash=item3a81566aa9)\n\n## Tests\n\n* [NIST Test](http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html)\n\n## Behind the scenes\n\n### ECMA 262\n\nhttp://www.ecma-international.org/ecma-262/5.1/#sec-15.8.2.14\n\n\u003e 15.8.2.14 random ( )\n\u003e Returns a Number value with positive sign, greater than or equal to 0 but less than 1, chosen randomly or pseudo randomly with approximately uniform distribution over that range, using an implementation-dependent algorithm or strategy. This function takes no arguments.\n\n[V8:Random](https://code.google.com/p/v8/source/browse/trunk/src/v8.cc#112)\n\n```cpp\n// Used by JavaScript APIs\nuint32_t V8::Random(Context* context) {\n  ASSERT(context-\u003eIsNativeContext());\n  ByteArray* seed = context-\u003erandom_seed();\n  uint32_t* state = reinterpret_cast\u003cuint32_t*\u003e(seed-\u003eGetDataStartAddress());\n\n  // When we get here, the RNG must have been initialized,\n  // see the Genesis constructor in file bootstrapper.cc.\n  ASSERT_NE(0, state[0]);\n  ASSERT_NE(0, state[1]);\n\n  // Mix the bits.  Never replaces state[i] with 0 if it is nonzero.\n  state[0] = 18273 * (state[0] \u0026 0xFFFF) + (state[0] \u003e\u003e 16);\n  state[1] = 36969 * (state[1] \u0026 0xFFFF) + (state[1] \u003e\u003e 16);\n\n  return (state[0] \u003c\u003c 14) + (state[1] \u0026 0x3FFFF);\n}\n```\n\nUpstream\n\n```cpp\nDEFINE_int(random_seed, 0,\n           \"Default seed for initializing random generator \"\n           \"(0, the default, means to use system random).\")\n```\n\nEntropySource\n\n```cpp\n\n#if V8_OS_CYGWIN || V8_OS_WIN\n  // Use rand_s() to gather entropy on Windows. See:\n  // https://code.google.com/p/v8/issues/detail?id=2905\n  unsigned first_half, second_half;\n  errno_t result = rand_s(\u0026first_half);\n  ASSERT_EQ(0, result);\n  result = rand_s(\u0026second_half);\n  ASSERT_EQ(0, result);\n  SetSeed((static_cast\u003cint64_t\u003e(first_half) \u003c\u003c 32) + second_half);\n#else\n  // Gather entropy from /dev/urandom if available.\n  FILE* fp = fopen(\"/dev/urandom\", \"rb\");\n  if (fp != NULL) {\n    int64_t seed;\n    size_t n = fread(\u0026seed, sizeof(seed), 1, fp);\n    fclose(fp);\n    if (n == 1) {\n      SetSeed(seed);\n      return;\n    }\n  }\n\n  // We cannot assume that random() or rand() were seeded\n  // properly, so instead of relying on random() or rand(),\n  // we just seed our PRNG using timing data as fallback.\n  // This is weak entropy, but it's sufficient, because\n  // it is the responsibility of the embedder to install\n  // an entropy source using v8::V8::SetEntropySource(),\n  // which provides reasonable entropy, see:\n  // https://code.google.com/p/v8/issues/detail?id=2905\n  int64_t seed = Time::NowFromSystemTime().ToInternalValue() \u003c\u003c 24;\n  seed ^= TimeTicks::HighResolutionNow().ToInternalValue() \u003c\u003c 16;\n  seed ^= TimeTicks::Now().ToInternalValue() \u003c\u003c 8;\n  SetSeed(seed);\n#endif  // V8_OS_CYGWIN || V8_OS_WIN\n}\n```\n\n### [node](https://github.com/joyent/node/blob/master/src/node.cc#L3345-L3349)\n\n```cpp\n#if HAVE_OPENSSL\n  // V8 on Windows doesn't have a good source of entropy. Seed it from\n  // OpenSSL's pool.\n  V8::SetEntropySource(crypto::EntropySource);\n#endif\n```\n\n### openssl\n\n* http://wiki.openssl.org/index.php/Random_Numbers\n* http://research.swtch.com/openssl\n\n\n### Hardware\n\n* https://en.wikipedia.org/wiki/Hardware_random_number_generator\n* https://en.wikipedia.org/wiki/Randomness_extractor\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmcw%2Fentropy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmcw%2Fentropy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmcw%2Fentropy/lists"}