Skip to content
Snippets Groups Projects
Commit 2be06c8f authored by Marcela Ribeiro de Oliveira's avatar Marcela Ribeiro de Oliveira
Browse files

lol

parent 015b867d
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,8 @@
#include <string>
#include <vector>
#include <iterator>
#include <sstream>
#include <cctype>
std::vector< char > createKM ( const std::string key);
std::string playfair(std::string text , const std::string key );
......@@ -36,7 +36,6 @@ std::string playfair(std::string text, const std::string key){
}
std::cout << std::endl;
}
int indexT = -1;
char fst = text[++indexT];
char snd = text[++indexT];
......@@ -47,17 +46,6 @@ std::string playfair(std::string text, const std::string key){
int iFst, iSnd;
for (int i=0; i<25; ++i){
if(mKey[i] == fst){
iFst=i;
}
if(mKey[i] == snd){
iSnd=i;
}
}
char retfst,retsnd;
retfst = mKey[iFst/5 + iSnd%5]
//TODO:change
return text;
}
#include "include/playfair.h"
#include <fstream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
void parser(std::string &text){
text.erase(std::remove(text.begin(), text.end(), ' '), text.end());
//for(const char &
}
int main(int argc, char *argv[]){
if(argc!=3){
......@@ -25,8 +28,9 @@ int main(int argc, char *argv[]){
while(std::getline(input, aux))
text << aux;
std::cout << text.str() << std::endl;
//chamar play fair passando string e chave
crip = playfair(text.str(), key);
crip = text.str();
parser(crip);
std::cout << crip << std::endl;
crip = playfair(crip, key);
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment