Merge pull request #1554 from sg5506844/Bcrypt-hash-detection-to-Analyse-hash

Add Bcrypt hash detection to "Analyse hash"
This commit is contained in:
a3957273 2024-02-04 01:19:30 +00:00 committed by GitHub
commit fd77152343
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 0 deletions

View File

@ -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,