0

I have a list of plaintext passwords that I would like to hash with various different hash algorithms (for educational purposes). As a minimum I would like to obtain hashes under MD5, SHA1, SHA256, (with and without salts), bcrypt, PBKDF2 and NTLM. Since hashcat supports all of these, I thought the simplest approach would be to run hashcat on the passwords with all the different algorithms.

However, to my astonishment (and frustration), I haven't been able to find a simple way of doing this in hashcat! Since hashcat is targeted towards breaking already hashed passwords, it requires a list of hashes, not plaintexts.

Thus, is there a way of simply running each algorithm in hashcat on a password in the clear - to obtain its hashed value?

Note: I don't really care if it's hashcat I use or not, I'm only looking for a simple way to hash some passwords with various different hash algorithms - minimizing the amount scripting I have to do myself. So if you have a better tool or approach, please share it.

closed as off-topic by TildalWave, Steve, Mark, Gilles, Adi Aug 10 '14 at 20:26

This question appears to be off-topic. The users who voted to close gave these specific reasons:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    This question would be more appropriate on unix&linux stack exchange, because it is about how to do something quickly in the command shell. – Philipp Aug 8 '14 at 14:32
  • "for educational purposes" what did you expect to learn ? – mpgn Aug 8 '14 at 19:19
  • @Phillip yes, I weren't sure where to put it either. Feel free to move it over to where you think it fits best. – hakoja Aug 8 '14 at 19:55
  • @martialdidit it's not for me, but intended for some students to illustrate the difference in cracking speeds of some common approaches to storing passwords. – hakoja Aug 8 '14 at 19:57
  • @hakoja Oh ! good idea, glad you teach by example to your students ! – mpgn Aug 8 '14 at 19:58
2

On most UNIXoid operating systems, the openssl command line program should be available. It implements most of the hashes you mention. To use it just for hashing, pipe the output of echo -n to openssl dgst -[ALGORITHM]. To calculate the SHA1 hashsum of "Hello World", for example, use this:

 echo -n "Hello World" | openssl dgst -sha1

openssl dgst supports the following algorithms: md5, md4, md2, sha1, sha, mdc2, ripemd160 .

  • 1
    OpenSSL has source for MD2 but it's excluded by default, you must custom build. It also has SHA-224,256,384,512 (but not the 180-4 "slash" variants) which I've seen used for pwhash, and Whirlpool which I haven't. The library has PBKDF2, but commandline can't access it directly. And you can add it on Windows with a Windows-friendly installer/uninstaller from slproweb.com/products/Win32OpenSSL.html . – dave_thompson_085 Aug 10 '14 at 10:22
1

Python has a library called passlib that contains all of those algorithms. Including NTLM which is broken into nthash and lmhash. You could create an array of schemes:

schemes = ["md5_crypt", ...]

Then setup a crypt context with that list:

pwd_context = CryptContext(schemes=["md5_crypt", "des_crypt"])

Then loop through len(schemes) calling:

hash = pwd_context.encrypt("passwordtohash", scheme=schemes[i])

Edit
It doesn't seem to be this simple. I'm researching once I have a working script I will post it.

Example of Usage
Add Salt Using encrypt() Download PassLib

Not the answer you're looking for? Browse other questions tagged or ask your own question.