PageSourceSearch

https://www.dhlottery.co.kr/common/rsa/rng.js

js dhlottery.co.kr collected 2026-09-24 09:41:08 UTC 1,883 bytes, 68 lines download raw bytes

1// Random number generator - requires a PRNG backend, e.g. prng4.js
2
3// For best results, put code like
4// <body onClick='rng_seed_time();' onKeyPress='rng_seed_time();'>
5// in your main HTML document.
6
7var rng_state;
8var rng_pool;
9var rng_pptr;
10
11// Mix in a 32-bit integer into the pool
12function rng_seed_int(x) {
13  rng_pool[rng_pptr++] ^= x & 255;
14  rng_pool[rng_pptr++] ^= (x >> 8) & 255;
15  rng_pool[rng_pptr++] ^= (x >> 16) & 255;
16  rng_pool[rng_pptr++] ^= (x >> 24) & 255;
17  if(rng_pptr >= rng_psize) rng_pptr -= rng_psize;
18}
19
20// Mix in the current time (w/milliseconds) into the pool
21function rng_seed_time() {
22  rng_seed_int(new Date().getTime());
23}
24
25// Initialize the pool with junk if needed.
26if(rng_pool == null) {
27  rng_pool = new Array();
28  rng_pptr = 0;
29  var t;
30  if(navigator.appName == "Netscape" && navigator.appVersion < "5" && window.crypto) {
31    // Extract entropy (256 bits) from NS4 RNG if available
32    var z = window.crypto.random(32);
33    for(t = 0; t < z.length; ++t)
34      rng_pool[rng_pptr++] = z.charCodeAt(t) & 255;
35  }  
36  while(rng_pptr < rng_psize) {  // extract some randomness from Math.random()
37    t = Math.floor(65536 * Math.random());
38    rng_pool[rng_pptr++] = t >>> 8;
39    rng_pool[rng_pptr++] = t & 255;
40  }
41  rng_pptr = 0;
42  rng_seed_time();
43  //rng_seed_int(window.screenX);
44  //rng_seed_int(window.screenY);
45}
46
47function rng_get_byte() {
48  if(rng_state == null) {
49    rng_seed_time();
50    rng_state = prng_newstate();
51    rng_state.init(rng_pool);
52    for(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr)
53      rng_pool[rng_pptr] = 0;
54    rng_pptr = 0;
55    //rng_pool = null;
56  }
57  // TODO: allow reseeding after first request
58  return rng_state.next();
59}
60
61function rng_get_bytes(ba) {
62  var i;
63  for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte();
64}
65
66function SecureRandom() {}
67
68SecureRandom.prototype.nextBytes = rng_get_bytes;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.