Permalink
Browse files

Remove bcrypt_hash.

Signed-off-by: François de Metz <fdemetz@af83.com>
  • Loading branch information...
1 parent 617e7e5 commit 0fd2f3e3eb1ddd847d41b6cf7daf82990fba4377 François de Metz committed Apr 20, 2011
Showing with 1 addition and 83 deletions.
  1. +0 −3 .gitmodules
  2. +0 −1 Makefile
  3. +0 −4 README.md
  4. +0 −2 config.js
  5. +0 −59 src/lib/bcrypt.js
  6. +1 −10 src/lib/hash.js
  7. +0 −3 src/tests/init.js
  8. +0 −1 vendors/bcrypt_hash
View
@@ -1,9 +1,6 @@
[submodule "vendors/jquery.mustache"]
path = vendors/jquery.mustache
url = git://github.com/AF83/jquery.mustache.git
-[submodule "vendors/bcrypt_hash"]
- path = vendors/bcrypt_hash
- url = git://github.com/virtuo/bcrypt_hash.git
[submodule "vendors/nodetk"]
path = vendors/nodetk
url = https://github.com/AF83/nodetk.git
View
@@ -4,7 +4,6 @@ all: install
install:
git submodule update --init --recursive
npm bundle
- cd vendors/bcrypt_hash && make && make clean
update_js_templates:
python vendors/jquery.mustache/src/generate_templates.py -l fr -d src/ms_templates -o src/static/js
View
@@ -77,12 +77,8 @@ auth_server Uses many other projects, including:
- [Backbone](http://documentcloud.github.com/backbone/)
- [underscore](http://documentcloud.github.com/underscore/)
- [node-mail](https://github.com/weaver/node-mail)
- - [bcrypt_hash](https://github.com/virtuo/bcrypt_hash)
- node (v0.4)
- mongodb (>=v1.4)
- - libbsd-dev
- - make
- - gcc
- xgettext and msgfmt (Debian package gettext)
$> git submodule update --init
View
@@ -12,8 +12,6 @@ var server = exports.server = {
port: 7070,
};
-exports.hash_lib = "crypto"; // either crypto or bcrypt, mostly for OS X compatability
-
var oauth2_server = exports.oauth2_server = {
authorize_url: '/oauth2/authorize',
process_login_url: '/oauth2/login',
View
@@ -1,59 +0,0 @@
-var exec = require('child_process').exec
- ;
-
-var bcrypt_path = __dirname + "/../../vendors/bcrypt_hash/"
- , bcrypt_hash = bcrypt_path + "bcrypt_hash "
- , bcrypt_check = bcrypt_path + "bcrypt_check "
- ;
-
-// Configuration:
-var conf = exports.conf = {
- nb_rounds: 10
-};
-
-
-var escape_pwd = function(password) {
- /* Returns password with escaped simple quotes: "'" -> "\'".
- */
- // here we must be carefull to avoid code injection here
- // XXX: do a node bcrypt module to avoid such risk?
- return password.replace(/'/g, "\\'");
-};
-
-
-exports.hash = function(password, callback, fallback) {
- /* Given a password, compute its hash using bcrypt algo.
- *
- * Arguments:
- * - password: string to be hashed.
- * - callback: will be called with the hash as first arguments.
- * - fallback: called in case of error.
- *
- */
- var cmd = bcrypt_hash +' '+ conf.nb_rounds +" '"+ escape_pwd(password) +"'";
- exec(cmd, function(error, stdout, stderr) {
- if(error) return fallback(error);
- // remove traliling \n from stdout:
- callback(stdout.slice(0, stdout.length-1));
- });
-};
-
-
-exports.check = function(hash, password, callback, fallback) {
- /* Given a password and a hash, check they match.
- *
- * Arguments:
- * - hash: string, the hash of expected password.
- * - password: string, the password to check.
- * - callback: to be called with a boolean as first argument. true if
- * password match hash, false otherwise.
- * - fallback: to be called with err as first argument, if something goes
- * wrong.
- *
- */
- var cmd = bcrypt_check + "'" + hash + "' '" + escape_pwd(password) + "'";
- exec(cmd, function(error, stdout, stderr) {
- if(error) return fallback(error);
- callback(stdout == "1\n");
- });
-};
View
@@ -1,13 +1,5 @@
var crypto = require("crypto");
-var bcrypt = require('./bcrypt');
-var config = require('./config_loader').get_config();
-
-var bcrypt_hash = {
- check: bcrypt.check
-, hash: bcrypt.hash
-};
-
var sha256_hash = {
check: function(expected_hash, given_password, callback, fallback) {
var hash = crypto.createHash('sha256').update(given_password).digest("hex");
@@ -19,5 +11,4 @@ var sha256_hash = {
}
};
-if(config.hash_lib == "crypto") module.exports = sha256_hash;
-else module.exports = bcrypt_hash;
+module.exports = sha256_hash;
View
@@ -25,9 +25,6 @@ var config = require('../lib/config_loader').get_config();
config.server.base_url = data.base_url;
config.db = 'db://localhost/auth_server_test';
-var bcrypt = require('../lib/bcrypt');
-bcrypt.conf.nb_rounds = 4; // So that tests run faster
-
var eyes = require('eyes')
;
Submodule bcrypt_hash deleted from d2758b

0 comments on commit 0fd2f3e

Please sign in to comment.