aboutsummaryrefslogtreecommitdiff
path: root/node_modules/bcrypt-nodejs/test-async.js
diff options
context:
space:
mode:
authorKumar Damani <kumar.damani@mail.utoronto.ca>2019-04-16 13:17:06 +0000
committerKumar Damani <kumar.damani@mail.utoronto.ca>2019-04-16 13:17:06 +0000
commitdc46b87abee1e441c07524ddde67fd902a919336 (patch)
tree13eba08b8655dfd78e9600ec5f612011a0bf3b35 /node_modules/bcrypt-nodejs/test-async.js
parent26f4b38e9e5a202756a7c33abc775aea2617aeaf (diff)
added some dependencies to package.json
Diffstat (limited to 'node_modules/bcrypt-nodejs/test-async.js')
-rw-r--r--node_modules/bcrypt-nodejs/test-async.js71
1 files changed, 0 insertions, 71 deletions
diff --git a/node_modules/bcrypt-nodejs/test-async.js b/node_modules/bcrypt-nodejs/test-async.js
deleted file mode 100644
index 42ce654..0000000
--- a/node_modules/bcrypt-nodejs/test-async.js
+++ /dev/null
@@ -1,71 +0,0 @@
-var bCrypt = require("./bCrypt");
-
-var compares = 0;
-var salts = [];
-var hashes = [];
-
-console.log("\n\n Salts \n");
-bCrypt.genSalt(8, saltCallback);
-bCrypt.genSalt(10, saltCallback);
-
-function saltCallback(error, result) {
- if(!error) {
- console.log(result);
- } else {
- console.log(error);
- }
- salts.push(result);
- if(salts.length == 2) {
- console.log("\n\n Hashes \n");
- createHash(salts[0]);
- }
-}
-
-function createHash(salt) {
- bCrypt.hash("bacon", salt, null, hashCallback);
- bCrypt.hash("bacon", salt, null, hashCallback);
-}
-
-function hashCallback(error, result) {
- if(!error) {
- console.log(result);
- } else {
- console.log(error);
- }
- hashes.push(result);
- if(hashes.length == 2) {
- createHash(salts[1]);
- } else if(hashes.length == 4) {
- console.log("\n\n True Compares \n");
- compares = 0;
- startCompares("bacon", trueCompareCallback);
- }
-}
-
-function startCompares(string, callback) {
- bCrypt.compare(string, hashes[0], callback);
- bCrypt.compare(string, hashes[1], callback);
- bCrypt.compare(string, hashes[2], callback);
- bCrypt.compare(string, hashes[3], callback);
-}
-
-function trueCompareCallback(error, result) {
- if(!error) {
- console.log(result);
- } else {
- console.log(error);
- }
- if(++compares == 4) {
- console.log("\n\n False Compares \n");
- compares = 0;
- startCompares("veggies", falseCompareCallback);
- }
-}
-
-function falseCompareCallback(error, result) {
- if(!error) {
- console.log(result);
- } else {
- console.log(error);
- }
-} \ No newline at end of file