Home > Software design >  Unhashing with certutil in batchfile
Unhashing with certutil in batchfile

Time:12-15

EDIT: You can not "unhash" text that has gone through a hashing algorithm. It's a one way process. I got hashing confused with encrypting. Thank you @aschipfl and @Anders for correcting me.

So I'm learning about hashing in Windows Batchfile and I was wondering if there is a simple way to unhash hashed text.

To hash the text, I have been using this:

set /p input=Text: 

echo %input%>%temp%\hashinput.tmp
CertUtil -hashfile %temp%\hashinput.tmp sha256 | findstr /v "hash">%temp%\hashoutput.tmp
set /p output=<%temp%\hashoutput.tmp

del %temp%\hashinput.tmp
del %temp%\hashoutput.tmp

echo %output%

All it's doing is sending the user input to a temporary file, hashing it and sending that to a temporary file and setting a variable to the output before removing the files.

After some looking around I, have been unable to find a way to unhash text using CertUtil or any other commands. If there is an easy way I would love to know how.

CodePudding user response:

There is no feasible way to get the original input from the hash, that is the whole point. You can try brute force by trying all possible inputs but that is not practical, it will take way too much time.

Another name for a hash is a one-way function...

  • Related