Most efficient way to break md5? if you know the result of a hash, for this example the resulting hash is: ec664d1d65fd8a58c59b337b11c37a4d

And you also know the hash has been made like this:



const salt = "asdjbsdhal"
const password = unknown; // only thing we don't know
const hash = md5(salt + password);


So we know that md5(salt + password) == "ec664d1d65fd8a58c59b337b11c37a4d".

Is there a more efficient way to break this password than brute-force?
The brute-force I'm trying right now is this:



const md5 = require("md5");

const expectedHash = "ec664d1d65fd8a58c59b337b11c37a4d";
const salt = "asdjbsdhal";
let nonce = 0;
let result = "";

while (result != expectedHash) {
  nonce++;
  result = md5(salt + nonce);
}

console.log("Password: ", nonce);
Searching for the hash on Google sometimes instantly gives the plaintext. However, that only works for some common hash values.

Other than that, there is no more efficient way than brute force. Even so, you can optimize the brute force algorithm to make it faster. Hashcat can run the attack on GPU's, making it possible to perform many hash calculations in parallel.