From 9f9320d37c8e02e78a9f0cd86f5997fc45e44d65 Mon Sep 17 00:00:00 2001 From: Stefano Balocco Date: Mon, 14 Oct 2013 15:30:52 +0200 Subject: [PATCH 01/11] Modified for NodeJS --- README.md | 2 +- isaac.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 99ac0c3..2a689c5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# isaac.js +# isaac.js - NodeJS compatibility version *isaac.js* is a JavaScript implementation of the [ISAAC](http://www.burtleburtle.net/bob/rand/isaac.html) random number generator. ISAAC is a [CSPRNG](http://en.wikipedia.org/wiki/CSPRNG) designed by [Robert J. Jenkins Jr.](http://burtleburtle.net/bob/) in 1996 and based on RC4. It is designed to be fast and secure. diff --git a/isaac.js b/isaac.js index a5f804f..6dde132 100644 --- a/isaac.js +++ b/isaac.js @@ -235,3 +235,5 @@ var isaac = (function(){ isaac.random = function() { return 0.5 + this.rand() * 2.3283064365386963e-10; // 2^-32 } + +module.exports = isaac; From b952914e9c627acc1b22e35d18631a77f6a43c18 Mon Sep 17 00:00:00 2001 From: Stefano Balocco Date: Mon, 14 Oct 2013 15:35:44 +0200 Subject: [PATCH 02/11] Added package.json --- package.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 0000000..b262826 --- /dev/null +++ b/package.json @@ -0,0 +1,16 @@ +{ + "author": "Yves-Marie K. Rinquin, ported to Node by Stefano Balocco", + "name": "isaac.js", + "description": "ISAAC is a CSPRNG designed by Robert J. Jenkins Jr. in 1996 and based on RC4. It is designed to be fast and secure.", + "version": "0.1", + "repository": { + "url": "https://github.com/StefanoBalocco/isaac.js.git" + }, + "isaac": "./isaac.js", + "dependencies": {}, + "devDependencies": {}, + "optionalDependencies": {}, + "engines": { + "node": "*" + } +} From a60f56b7cfbf19588771ba98c9a5d301adddb91d Mon Sep 17 00:00:00 2001 From: Stefano Balocco Date: Mon, 14 Oct 2013 15:41:15 +0200 Subject: [PATCH 03/11] Fixed package.json --- package.json | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index b262826..27c2146 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,32 @@ { - "author": "Yves-Marie K. Rinquin, ported to Node by Stefano Balocco", - "name": "isaac.js", - "description": "ISAAC is a CSPRNG designed by Robert J. Jenkins Jr. in 1996 and based on RC4. It is designed to be fast and secure.", - "version": "0.1", - "repository": { - "url": "https://github.com/StefanoBalocco/isaac.js.git" - }, - "isaac": "./isaac.js", - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "engines": { - "node": "*" - } + "author": "Yves-Marie K. Rinquin", + "name": "isaac.js", + "description": "ISAAC is a CSPRNG designed by Robert J. Jenkins Jr. in 1996 and based on RC4. It is designed to be fast and secure.", + "version": "0.0.1", + "repository": + { + "type": "git", + "url": "git://github.com/StefanoBalocco/isaac.js.git" + }, + "keywords": + [ + "PRNG", + "CPRNG", + "CSPRNG", + "isaac" + ], + "maintainers": + [ + { + "name": "Stefano Balocco", + "email": "stefano.balocco@gmail.com" + } + ], + "isaac": "./isaac.js", + "dependencies": {}, + "devDependencies": {}, + "optionalDependencies": {}, + "engines": { + "node": "*" + } } From 8cfbe70e64bd3dc4e528ddd253794e6a641836d0 Mon Sep 17 00:00:00 2001 From: Stefano Balocco Date: Mon, 14 Oct 2013 15:56:37 +0200 Subject: [PATCH 04/11] Fixed package.json --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 27c2146..1507978 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Yves-Marie K. Rinquin", "name": "isaac.js", "description": "ISAAC is a CSPRNG designed by Robert J. Jenkins Jr. in 1996 and based on RC4. It is designed to be fast and secure.", - "version": "0.0.1", + "version": "0.0.2", "repository": { "type": "git", @@ -10,9 +10,9 @@ }, "keywords": [ - "PRNG", - "CPRNG", - "CSPRNG", + "prng", + "cprng", + "csprng", "isaac" ], "maintainers": From dff5fbb369f9f8ecd698368df0bf85b6e8c2245a Mon Sep 17 00:00:00 2001 From: Stefano Balocco Date: Mon, 14 Oct 2013 15:59:19 +0200 Subject: [PATCH 05/11] Fixed README.md --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2a689c5..2e8e446 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,14 @@ ISAAC is a [CSPRNG](http://en.wikipedia.org/wiki/CSPRNG) designed by [Robert J. *isaac.js* is fully compatible with the other *32-bit integer arithmetic* implementations of ISAAC and can be used as a good alternative to the default javascript `Math.random()` function. ##Use -Include isaac.js into your html file: ``. Then just call `isaac.random()` to get a random real number between 0.0 and 1.0 : +` +npm install isaac.js +` -`var random_number = isaac.random();` +`var isaac = require( 'isaac.js' );` + +Then just call `isaac.random()` to get a random real number between 0.0 and 1.0 : +`var random_number = isaac.random( );` If you want a little more control over the PRNG you can reset isaac (all internals to zero) using `isaac.reset()` or use a new seed using `isaac.seed(s)` (*s* can be a string, a number or an array of number). You can also run the PRNG an arbitrary number of time before querying a new random output using `isaac.prng(n)`, where *n* (optional) is the number of run. `isaac.rand()` allow you to get a random 32-bit integer between -2147483648 (0x00000000) and 2147483647 (0xFFFFFFFF). From 111efbe5bfc3ff2a76a419d41107375244e9da12 Mon Sep 17 00:00:00 2001 From: Stefano Balocco Date: Mon, 14 Oct 2013 15:59:38 +0200 Subject: [PATCH 06/11] Updated package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1507978..f078233 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Yves-Marie K. Rinquin", "name": "isaac.js", "description": "ISAAC is a CSPRNG designed by Robert J. Jenkins Jr. in 1996 and based on RC4. It is designed to be fast and secure.", - "version": "0.0.2", + "version": "0.0.3", "repository": { "type": "git", From 7fefe2359e3a8aac21dfbdb0ff2e16634e2ad4a6 Mon Sep 17 00:00:00 2001 From: Stefano Balocco Date: Mon, 14 Oct 2013 16:29:55 +0200 Subject: [PATCH 07/11] Fixed/updated package.json and renamed the package to "isaac" --- isaac-test.htm | 136 ------------------------------------------------- package.json | 20 ++------ 2 files changed, 4 insertions(+), 152 deletions(-) delete mode 100644 isaac-test.htm diff --git a/isaac-test.htm b/isaac-test.htm deleted file mode 100644 index 9ae06fd..0000000 --- a/isaac-test.htm +++ /dev/null @@ -1,136 +0,0 @@ - - - - - A javascript implementation of ISAAC - - - - -

-  
-  
-  
-
diff --git a/package.json b/package.json
index f078233..af9ea13 100644
--- a/package.json
+++ b/package.json
@@ -1,8 +1,8 @@
 {
 	"author": "Yves-Marie K. Rinquin",
-	"name": "isaac.js",
+	"name": "isaac",
 	"description": "ISAAC is a CSPRNG designed by Robert J. Jenkins Jr. in 1996 and based on RC4. It is designed to be fast and secure.",
-	"version": "0.0.3",
+	"version": "0.0.1",
 	"repository":
 	{
 		"type": "git",
@@ -15,18 +15,6 @@
 		"csprng",
 		"isaac"
 	],
-	"maintainers":
-	[
-		{
-			"name": "Stefano Balocco",
-			"email": "stefano.balocco@gmail.com"
-		}
-	],
-	"isaac": "./isaac.js",
-	"dependencies": {},
-	"devDependencies": {},
-	"optionalDependencies": {},
-	"engines": {
-		"node": "*"
-	}
+	"main": "./isaac.js",
+	"license": "MIT"
 }

From 2c329e3fcdd9ddf703a2b6514fdf15f40f25753c Mon Sep 17 00:00:00 2001
From: Stefano Balocco 
Date: Mon, 14 Oct 2013 16:46:29 +0200
Subject: [PATCH 08/11] Fixed README.md and updated version to 0.0.2

---
 README.md    | 4 ++--
 package.json | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 2e8e446..21d341d 100644
--- a/README.md
+++ b/README.md
@@ -7,10 +7,10 @@ ISAAC is a [CSPRNG](http://en.wikipedia.org/wiki/CSPRNG) designed by [Robert J.
 
 ##Use
 `
-npm install isaac.js
+npm install isaac
 `
 
-`var isaac = require( 'isaac.js' );`
+`var isaac = require( 'isaac' );`
 
 Then just call `isaac.random()` to get a random real number between 0.0 and 1.0 :
 `var random_number = isaac.random( );`
diff --git a/package.json b/package.json
index af9ea13..161fa03 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
 	"author": "Yves-Marie K. Rinquin",
 	"name": "isaac",
 	"description": "ISAAC is a CSPRNG designed by Robert J. Jenkins Jr. in 1996 and based on RC4. It is designed to be fast and secure.",
-	"version": "0.0.1",
+	"version": "0.0.2",
 	"repository":
 	{
 		"type": "git",

From 49e2fde9f46fa00d8cd8abcc40fefe9a7c3c586f Mon Sep 17 00:00:00 2001
From: Stefano Balocco 
Date: Mon, 14 Oct 2013 16:56:30 +0200
Subject: [PATCH 09/11] Updated to work inside and outside nodejs Updated to
 version 0.0.3

---
 isaac.js     | 2 +-
 package.json | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/isaac.js b/isaac.js
index 6dde132..c0e8924 100644
--- a/isaac.js
+++ b/isaac.js
@@ -236,4 +236,4 @@ isaac.random = function() {
   return 0.5 + this.rand() * 2.3283064365386963e-10; // 2^-32
 }
 
-module.exports = isaac;
+( "undefined" !== ( typeof( module ) ) ) && module.exports && ( module.exports = isaac );
diff --git a/package.json b/package.json
index 161fa03..8660745 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
 	"author": "Yves-Marie K. Rinquin",
 	"name": "isaac",
 	"description": "ISAAC is a CSPRNG designed by Robert J. Jenkins Jr. in 1996 and based on RC4. It is designed to be fast and secure.",
-	"version": "0.0.2",
+	"version": "0.0.3",
 	"repository":
 	{
 		"type": "git",

From 0145f0ec2ba8e099fbd39fbe314d33da1a2b3dec Mon Sep 17 00:00:00 2001
From: Stefano Balocco 
Date: Sat, 26 Apr 2014 00:45:45 +0200
Subject: [PATCH 10/11] Fixed .random

---
 isaac.js     | 10 +++++-----
 package.json |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/isaac.js b/isaac.js
index c0e8924..2700340 100644
--- a/isaac.js
+++ b/isaac.js
@@ -221,19 +221,19 @@ var isaac = (function(){
     return {a: acc, b: brs, c: cnt, m: m, r: r};
   }
 
+  function random(){
+    return 0.5 + this.rand() * 2.3283064365386963e-10; // 2^-32
+  }
+
   /* return class object */
   return {
     'reset': reset,
     'seed':  seed,
     'prng':  prng,
     'rand':  rand,
+    'ranodm': random,
     'internals': internals
   };
 })(); /* declare and execute */
 
-/* public: output*/
-isaac.random = function() {
-  return 0.5 + this.rand() * 2.3283064365386963e-10; // 2^-32
-}
-
 ( "undefined" !== ( typeof( module ) ) ) && module.exports && ( module.exports = isaac );
diff --git a/package.json b/package.json
index 8660745..2e56ffb 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
 	"author": "Yves-Marie K. Rinquin",
 	"name": "isaac",
 	"description": "ISAAC is a CSPRNG designed by Robert J. Jenkins Jr. in 1996 and based on RC4. It is designed to be fast and secure.",
-	"version": "0.0.3",
+	"version": "0.0.4",
 	"repository":
 	{
 		"type": "git",

From ec8871eb2c15d997957e49577e88567a4025cb3f Mon Sep 17 00:00:00 2001
From: Stefano Balocco 
Date: Sat, 26 Apr 2014 21:46:49 +0200
Subject: [PATCH 11/11] Fixed a typo

---
 isaac.js     | 2 +-
 package.json | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/isaac.js b/isaac.js
index 2700340..b2d07a8 100644
--- a/isaac.js
+++ b/isaac.js
@@ -231,7 +231,7 @@ var isaac = (function(){
     'seed':  seed,
     'prng':  prng,
     'rand':  rand,
-    'ranodm': random,
+    'random': random,
     'internals': internals
   };
 })(); /* declare and execute */
diff --git a/package.json b/package.json
index 2e56ffb..f0c595c 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
 	"author": "Yves-Marie K. Rinquin",
 	"name": "isaac",
 	"description": "ISAAC is a CSPRNG designed by Robert J. Jenkins Jr. in 1996 and based on RC4. It is designed to be fast and secure.",
-	"version": "0.0.4",
+	"version": "0.0.5",
 	"repository":
 	{
 		"type": "git",