--- /dev/null
+// mnenc.cpp\r
+// \r
+// Copyright 2010 Micke Nordin <mickewiki@gmail.com>\r
+// \r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 3 of the License, or\r
+// (at your option) any later version.\r
+// \r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+// GNU General Public License for more details.\r
+// \r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r
+// MA 02110-1301, USA.\r
+\r
+\r
+\r
+#include <iostream>\r
+#include <string>\r
+#include <fstream>\r
+#include <cstdlib>\r
+#include <ctime>\r
+#include "mnenc.hpp"\r
+\r
+mnenc::mnenc() {\r
+ key = "";\r
+}\r
+\r
+void mnenc::genkey(std::string str) {\r
+ key = str + str + str + str + str + str + str + str + str;\r
+}\r
+\r
+std::string mnenc::encrypt(std::string key, std::string str) {\r
+ for(int i=0; i < (signed) str.size(); i++) {\r
+ str[i]=str[i]^key[i];\r
+ }\r
+ return str;\r
+}\r
+ \r
+std::string mnenc::decrypt(std::string key, std::string passwd) {\r
+ for(int i=0; i < (signed) passwd.size(); i++) {\r
+ passwd[i] = key[i] ^ passwd[i];\r
+ }\r
+ return passwd;\r
+}\r
+std::string mnenc::get_key() {\r
+ if(key != "") {\r
+ return key;\r
+ } else {\r
+ std::cerr << "Error: No key generated.";\r
+ return key;\r
+ }\r
+}\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r