Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added testBasicHash; fixed typo in readme

  • Loading branch information...
commit e914a4f9835aea3e73eb13f98b7db456f670ed85 1 parent 49e5ed5
@kbjr authored
Showing with 21 additions and 4 deletions.
  1. +14 −1 lib/sechash.js
  2. +1 −1  package.json
  3. +6 −2 readme.textile
View
15 lib/sechash.js
@@ -4,7 +4,7 @@
* Secure password hashing using salt and keystretching
*
* @author James Brumond
- * @version 0.1.1
+ * @version 0.1.2
* @copyright Copyright 2011 James Brumond
* @license Dual licensed under MIT and GPL
*/
@@ -52,6 +52,19 @@ module.exports = (function() {
};
/**
+ * Test a simple hash
+ *
+ * @access public
+ * @param string the hashing algorithm
+ * @param string the string to test
+ * @param string the hash to test
+ * @return boolean
+ */
+ self.testBasicHash = function(alg, str, testHash) {
+ return (hash(alg, str) === testHash);
+ };
+
+ /**
* Hash a string with salt and key stretching
*
* @access public
View
2  package.json
@@ -2,7 +2,7 @@
"author": "James Brumond <kbjr14@gmail.com> (http://jbrumond.me)",
"name": "sechash",
"description": "Secure password hashing with salt and key stretching",
- "version": "0.1.1",
+ "version": "0.1.2",
"repository": {
"type": "git",
"url": "git://github.com/kbjr/node-sechash.git"
View
8 readme.textile
@@ -3,7 +3,7 @@ h1. sechash
h4. Secure password hashing with salt and key stretching
Author: James Brumond
-Version: 0.1.1
+Version: 0.1.2
Copyright 2011 James Brumond
Dual licensed under MIT and GPL
@@ -20,7 +20,11 @@ h3. Running a simple hash
// This will do a simple md5 hash, the same as if you used the
// built-in "crypto" module.
-var hash = sechash.simpleHash('md5', 'Your String');</code></pre>
+var hash = sechash.basicHash('md5', 'Your String');
+
+// You can also use the testBasicHash method to easily test if
+// a string matches a hash
+sechash.testBasicHash('md5', 'Your String', hash); // true</code></pre>
h3. Using the strong stuff
Please sign in to comment.
Something went wrong with that request. Please try again.