-1

I need to generate 26! lists of alphabet recusively in order to solve a cipher with brute force. I don't know how to generate this much lists. Any help would be appreciated.

morgan
  • 1
  • 3
  • https://stackoverflow.com/q/49848994/124319 – coredump Oct 31 '19 at 13:31
  • 2
    The factorial of 26 is an insanely large number. You need a better approach. If you're trying to crack a substitution cipher, use [frequency analysis](https://en.wikipedia.org/wiki/Frequency_analysis). – r3mainer Oct 31 '19 at 13:53
  • Yes, frequency analysis is better bu I'm only allowed to use brute force method. – morgan Oct 31 '19 at 19:04
  • What are your inputs? Do you have a known plaintext/ciphertext pair? Or is only the ciphertext known? If only the ciphertext is known, what is your decision function for recognizing decrypted plaintext? – Kaz Oct 31 '19 at 21:40
  • If you are only allowed to use brute force then, unless you know the plaintext, give up. –  Nov 01 '19 at 09:57

1 Answers1

0

You can't practically do this. 26! is about 4E26 (specifically it is 403291461126605635584000000). If you could generate these at a rate of a billion per second, you would require about 4E17 seconds to do so. This is about 12E9 years. The universe is 13.8E9 years old.

So, if you could work at this rate you could probably do this ... if you had the age of the universe to do it in. If you could throw ten million processors at it, each working at a billion a second, you could do it in about only about 1200 years.

This is why brute force approaches to solving cryptography problems are often not a good idea.