Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

remove deprecated functions

We have allowed enough time to pass for upgrading to new functions.

close #201
  • Loading branch information...
commit 3431e7d1ad9f51827cc155489b99d0a04817f173 1 parent 68cfeb6
@defunctzombie defunctzombie authored
Showing with 0 additions and 70 deletions.
  1. +0 −36 bcrypt.js
  2. +0 −34 test/deprecated.js
View
36 bcrypt.js
@@ -4,12 +4,6 @@ var bindings = require('bindings')('bcrypt_lib');
/// @param {Number} [rounds] number of rounds (default 10)
/// @param {Number} [seed_length] number of random bytes (default 20)
/// @return {String} salt
-module.exports.gen_salt_sync = function(rounds, seed_length) {
- console.log("DEPRECATION WARNING: `gen_salt_sync` has been deprecated. Please use `genSaltSync` instead.");
-
- return module.exports.genSaltSync(rounds, seed_length);
-}
-
module.exports.genSaltSync = function(rounds, seed_length) {
// default 10 rounds
if (!rounds) {
@@ -32,12 +26,6 @@ module.exports.genSaltSync = function(rounds, seed_length) {
/// @param {Number} [rounds] number of rounds (default 10)
/// @param {Number} [seed_length] number of random bytes (default 20)
/// @param {Function} cb callback(err, salt)
-module.exports.gen_salt = function(rounds, seed_length, cb) {
- console.log("DEPRECATION WARNING: `gen_salt` has been deprecated. Please use `genSalt` instead.");
-
- return module.exports.genSalt(rounds, seed_length, cb);
-}
-
module.exports.genSalt = function(rounds, seed_length, cb) {
// if callback is first argument, then use defaults for others
if (typeof arguments[0] === 'function') {
@@ -77,12 +65,6 @@ module.exports.genSalt = function(rounds, seed_length, cb) {
/// @param {String} data the data to encrypt
/// @param {String} salt the salt to use when hashing
/// @return {String} hash
-module.exports.encrypt_sync = function(data, salt) {
- console.log("DEPRECATION WARNING: `encrypt_sync` has been deprecated. Please use `hashSync` instead.");
-
- return module.exports.hashSync(data, salt);
-}
-
module.exports.hashSync = function(data, salt) {
if (data == null || data == undefined || salt == null || salt == undefined) {
throw new Error('data and salt arguments required');
@@ -101,12 +83,6 @@ module.exports.hashSync = function(data, salt) {
/// @param {String} data the data to encrypt
/// @param {String} salt the salt to use when hashing
/// @param {Function} cb callback(err, hash)
-module.exports.encrypt = function(data, salt, cb) {
- console.log("DEPRECATION WARNING: `encrypt` has been deprecated. Please use `hash` instead.");
-
- return module.exports.hash(data, salt, cb);
-}
-
module.exports.hash = function(data, salt, cb) {
if (typeof data === 'function') {
return data(new Error('data must be a string and salt must either be a salt string or a number of rounds'));
@@ -137,12 +113,6 @@ module.exports.hash = function(data, salt, cb) {
/// @param {String} data the data to hash and compare
/// @param {String} hash expected hash
/// @return {bool} true if hashed data matches hash
-module.exports.compare_sync = function(data, hash) {
- console.log("DEPRECATION WARNING: `compare_sync` has been deprecated. Please use `compareSync` instead.");
-
- return module.exports.compareSync(data, hash);
-}
-
module.exports.compareSync = function(data, hash) {
if (data == null || data == undefined || hash == null || hash == undefined) {
throw new Error('data and hash arguments required');
@@ -173,12 +143,6 @@ module.exports.compare = function(data, hash, cb) {
/// @param {String} hash extract rounds from this hash
/// @return {Number} the number of rounds used to encrypt a given hash
-module.exports.get_rounds = function(hash) {
- console.log("DEPRECATION WARNING: `get_rounds` has been deprecated. Please use `getRounds` instead.");
-
- return module.exports.getRounds(hash);
-}
-
module.exports.getRounds = function(hash) {
if (hash == null || hash == undefined) {
throw new Error('hash argument required');
View
34 test/deprecated.js
@@ -1,34 +0,0 @@
-var bcrypt = require('../bcrypt');
-
-module.exports = {
- test_encrypt: function(assert) {
- assert.expect(1);
- bcrypt.gen_salt(10, function(err, salt) {
- bcrypt.encrypt('password', salt, function(err, res) {
- assert.ok(res, "Res should be defined.");
- assert.done();
- });
- });
- },
- test_gen_salt_sync: function(assert) {
- var salt = bcrypt.gen_salt_sync(10);
- assert.equals(29, salt.length, "Salt isn't the correct length.");
- var split_salt = salt.split('$');
- assert.ok(split_salt[1], '2a');
- assert.ok(split_salt[2], '10');
- assert.done();
- },
- test_encrypt_compare_sync: function(assert) {
- var salt = bcrypt.gen_salt_sync(10);
- assert.equals(29, salt.length, "Salt isn't the correct length.");
- var hash = bcrypt.encrypt_sync("test", salt);
- assert.ok(bcrypt.compare_sync("test", hash), "These hashes should be equal.");
- assert.ok(!(bcrypt.compare_sync("blah", hash)), "These hashes should not be equal.");
- assert.done();
- },
- test_get_rounds_sync: function(assert) {
- var hash = bcrypt.encrypt_sync("test", bcrypt.gen_salt_sync(9));
- assert.equals(9, bcrypt.get_rounds(hash), "get_rounds can't extract rounds");
- assert.done();
- }
-}
Please sign in to comment.
Something went wrong with that request. Please try again.