Skip to content

Instantly share code, notes, and snippets.

@martani
Created April 27, 2011 19:07
Show Gist options
  • Save martani/944949 to your computer and use it in GitHub Desktop.
Save martani/944949 to your computer and use it in GitHub Desktop.
Splitting Vigenere cipher into Caesar groups
static List<string> SplitTextWithKeyLen(string text, int keyLen)
{
List<string> result = new List<string>();
StringBuilder[] sb = new StringBuilder[keyLen];
for (int i = 0; i < keyLen; i++)
sb[i] = new StringBuilder();
for (int i = 0; i < text.Length; i++)
sb[i % keyLen].Append(text[i]);
foreach (var item in sb)
result.Add(item.ToString());
result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment