title: Break a Caesar-cipher cipher text without knowing the plaintext or the key through frequency-analysis
body: <p>I am trying to make a program which can help you to break a cipher text without knowing the plain text and the key.</p>
  
  <p>I want  probable plain text at the output which gives the closest statistical values and a set of  probable candidates keys</p>
  
  <p>I started doing the frequency analysis,completed it. It helped  me in telling the occurrence of each alphabet, but I have no idea how will I generate keys from that.</p>
  
  <pre><code>class Program
  {
       static void Main()
       {
           // Array to store frequencies.
           int[] c = new int[(int)char.MaxValue];
  
  
           // Read entire text file.
              string s = File.ReadAllText("text.txt");
  
  
            // Iterate over each character.
            foreach (char t in s)
              {
              // Increment table.
              c[(int)t]++;
           }
  
  
            // Write all letters found.
           for (int i = 0; i &lt; (int)char.MaxValue; i++)
           {
              if (c[i] &gt; 0 &amp;&amp;
              char.IsLetterOrDigit((char)i))
              {
              Console.WriteLine("Letter: {0}  Frequency: {1}",
                  (char)i,
                  c[i]);
              }
           }
      }
  }
  </code></pre>