From 0e0bafdeb6e3d75990c7b8660b53156cc93c13f0 Mon Sep 17 00:00:00 2001 From: sg5506844 <130462468+sg5506844@users.noreply.github.com> Date: Wed, 12 Apr 2023 11:20:18 +0530 Subject: [PATCH] Add Bcrypt hash detection to "Analyse hash" --- src/core/operations/AnalyseHash.mjs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/core/operations/AnalyseHash.mjs b/src/core/operations/AnalyseHash.mjs index 72c80840..ad9202f5 100644 --- a/src/core/operations/AnalyseHash.mjs +++ b/src/core/operations/AnalyseHash.mjs @@ -35,6 +35,17 @@ class AnalyseHash extends Operation { run(input, args) { input = input.replace(/\s/g, ""); + // analyze hash if it is bcrypt + if (/^\$2[abxy]?\$[0-9]+\$[a-zA-Z0-9/.]{53}$/.test(input)) { + input = input.split("$"); + return "Hash algorithm Identifier: $" + input[1] + "$\n" + + "Rounds: " + input[2] + "\n" + + "Base64 encoded Input salt(22 bytes): " + input[3].slice(0, 22) + "\n" + + "Base64 encoded hash(31 bytes): " + input[3].slice(22) + "\n\n" + + "Based on the length, this hash could have been generated by one of the following hashing functions:\n" + + "bcrypt"; + } + let output = "", possibleHashFunctions = []; const byteLength = input.length / 2,