From 61c670954a60bf21aa20458109c4bd337481ac77 Mon Sep 17 00:00:00 2001 From: Emeraude Date: Mon, 8 Dec 2014 20:48:04 +0100 Subject: [PATCH 1/4] Change the way it works : require("mhash") return directly the hashing function. Improve code parts in the doc --- README.md | 28 +++++++++++++++------------- index.js | 2 +- package.json | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 58be285..153a69f 100644 --- a/README.md +++ b/README.md @@ -14,17 +14,18 @@ npm install mhash Usage ===== -
-	Syntax: hash("algo-type", String || Buffer)
-	First argument is a string, one of the supported algorihms below.
-	Second argument can either be a String or a Buffer.
-
-
-var hash = require("mhash").hash;
+```javascript
+Syntax: hash("algo-type", String || Buffer)
+//First argument is a string, one of the supported algorihms below.
+//Second argument can either be a String or a Buffer.
+```
 
-console.log(hash("md2", "testing"));
-
+```javascript +var hash = require("mhash"); + +console.log(mhash("md2", "testing")); +``` Supported Hashing Algorithms @@ -95,7 +96,8 @@ See [Issue #1](https://github.com/Sembiance/node-mhash/issues/1) for more detail Manual Installation =================== - git clone "https://github.com/Sembiance/node-mhash.git" - cd node-mhash - node-waf configure build - +```bash +git clone "https://github.com/Sembiance/node-mhash.git" +cd node-mhash +node-waf configure build +``` diff --git a/index.js b/index.js index 9fee38b..a2d3d67 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -exports.hash = require("bindings")("mhash.node").hash; +module.exports = require("bindings")("mhash.node").hash; diff --git a/package.json b/package.json index 64edc29..9420109 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { "name": "mhash", - "version": "1.0.0", + "version": "1.1.0", "author": "Robert Schultz ", "description": "Provides 27 hashing algorithms: md5, md4, md2, sha1, sha256, whirlpool, crc32, etc. MacOS X requires Xcode to be installed.", "main": "index", From d9d5daedc0348e903926da976c65614a3c494c9c Mon Sep 17 00:00:00 2001 From: Emeraude Date: Mon, 8 Dec 2014 20:49:57 +0100 Subject: [PATCH 2/4] fix README --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 153a69f..4c80fc7 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,9 @@ NOTE: MacOS X users need to have XCode installed (provides gcc) Installation with NPM ===================== -npm install mhash - +```bash +npm install mhash --python=python2 +``` Usage ===== From c264a16863c9cd0124c6fb41430a03ae2f4348b3 Mon Sep 17 00:00:00 2001 From: Emeraude Date: Mon, 8 Dec 2014 21:04:47 +0100 Subject: [PATCH 3/4] fix readme; i don't know to write --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4c80fc7..82410e1 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Syntax: hash("algo-type", String || Buffer) ```javascript var hash = require("mhash"); -console.log(mhash("md2", "testing")); +console.log(hash("md2", "testing")); ``` From 7485b310e51846a5d4d63182a000904988c63d5b Mon Sep 17 00:00:00 2001 From: Emeraude Date: Mon, 8 Dec 2014 21:29:01 +0100 Subject: [PATCH 4/4] update tests --- test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test.js b/test.js index 0299d35..0117c1e 100644 --- a/test.js +++ b/test.js @@ -1,7 +1,7 @@ //console.log("Only works if you've done `npm install mhash`"); -//var hash = require("mhash").hash; +//var hash = require("mhash"); -var hash = require("./index").hash; +var hash = require("./index"); console.log(hash("md2", "testing")); console.log("\nNext should be: 0c1e02ff");