tags:

views:

141

answers:

1

Hi, Does anyone know how to write a brute force program where if, say, the lenght is 4, in the beginning, the string would be a\0\0\0, b\0\0\0,..., ab\0\0 and so on, ie keeping its NULLs. My question is for a password cracking homework. Thanks

+3  A: 

Here's an algorithm:

  1. memset it all to null.
  2. Increment the first character.
  3. Repeat step 2 until the first character overflows.
  4. Increment the second character
  5. Go back to step 2 and repeat until the second character overlows.
  6. Increment the third character.
  7. You get the idea...

I leave the implementation up to you. It's your homework.

Anon.