Skip to content

Instantly share code, notes, and snippets.

@nuriyevn
Created January 23, 2019 12:38
Show Gist options
  • Save nuriyevn/d80a5c9bc9c918c282a742048a22d69f to your computer and use it in GitHub Desktop.
Save nuriyevn/d80a5c9bc9c918c282a742048a22d69f to your computer and use it in GitHub Desktop.
Chipher Vigenere
int main()
{
std::string str = "ATTACKATDAWN";
std::string key = "LEMONLEMONLE";
std::string result;
int keyIndex = 0;
char s_buffer[100];
int i = 0;
for (i = 0; i < str.length(); i++)
{
char chiphed = Vigenere(str[i], key[i]);
(keyIndex == key.length() - 1) ? keyIndex = 0 : keyIndex++;
s_buffer[i] = chiphed;
}
s_buffer[i] = 0;
std::cout << s_buffer << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment