3 // Copyright 2010 Micke Nordin <mickewiki@gmail.com>
\r
5 // This program is free software; you can redistribute it and/or modify
\r
6 // it under the terms of the GNU General Public License as published by
\r
7 // the Free Software Foundation; either version 3 of the License, or
\r
8 // (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software
\r
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
\r
18 // MA 02110-1301, USA.
\r
27 #include "mnenc.hpp"
\r
33 void mnenc::genkey(std::string str) {
\r
34 key = str + str + str + str + str + str + str + str + str;
\r
37 std::string mnenc::encrypt(std::string key, std::string str) {
\r
38 for(int i=0; i < (signed) str.size(); i++) {
\r
39 str[i]=str[i]^key[i];
\r
44 std::string mnenc::decrypt(std::string key, std::string passwd) {
\r
45 for(int i=0; i < (signed) passwd.size(); i++) {
\r
46 passwd[i] = key[i] ^ passwd[i];
\r
50 std::string mnenc::get_key() {
\r
54 std::cerr << "Error: No key generated.";
\r