package securemsg.core;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import securemsg.database.*;
public class SecureMsgMain {
public static String a = Encodevariables.a;
public static String b = Encodevariables.b;
public static String c = Encodevariables.c;
public static String d = Encodevariables.d;
public static String e = Encodevariables.e;
public static String f = Encodevariables.f;
public static String g = Encodevariables.g;
public static String h = Encodevariables.h;
public static String i = Encodevariables.i;
public static String j = Encodevariables.j;
public static String k = Encodevariables.k;
public static String l = Encodevariables.l;
public static String m = Encodevariables.m;
public static String n = Encodevariables.n;
public static String o = Encodevariables.o;
public static String p = Encodevariables.p;
public static String q = Encodevariables.q;
public static String r = Encodevariables.r;
public static String s = Encodevariables.s;
public static String t = Encodevariables.t;
public static String u = Encodevariables.u;
public static String v = Encodevariables.v;
public static String w = Encodevariables.w;
public static String x = Encodevariables.x;
public static String y = Encodevariables.y;
public static String z = Encodevariables.z;
public static String dea = Decodevariables.dea;
public static String deb = Decodevariables.deb;
public static String dec = Decodevariables.dec;
public static String ded = Decodevariables.ded;
public static String dee = Decodevariables.dee;
public static String def = Decodevariables.def;
public static String deg = Decodevariables.deg;
public static String deh = Decodevariables.deh;
public static String dei = Decodevariables.dei;
public static String dej = Decodevariables.dej;
public static String dek = Decodevariables.dek;
public static String del = Decodevariables.del;
public static String dem = Decodevariables.dem;
public static String den = Decodevariables.den;
public static String deo = Decodevariables.deo;
public static String dep = Decodevariables.dep;
public static String deq = Decodevariables.deq;
public static String der = Decodevariables.der;
public static String des = Decodevariables.des;
public static String det = Decodevariables.det;
public static String deu = Decodevariables.deu;
public static String dev = Decodevariables.dev;
public static String dew = Decodevariables.dew;
public static String dex = Decodevariables.dex;
public static String dey = Decodevariables.dey;
public static String dez = Decodevariables.dez;
String enmsg = null;
String demsg = null;
public static void main(String[] args) throws IOException {
run();
}
public static void run() throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String option;
print("================================");
print("encode [Add protection to input]");
print("decode [Read the protected info]");
print("================================");
option = in.readLine().toLowerCase().trim();
while (option != null) {
BufferedReader code = new BufferedReader(new InputStreamReader(System.in));
if (option.equalsIgnoreCase("encode")) {
String enmsg = code.readLine().toLowerCase();
enmsg = enmsg.replace("a", a).replace("b", b)
.replace("c", c).replace("d", d)
.replace("e", e).replace("f", f)
.replace("g", g).replace("h", h)
.replace("i", i).replace("j", j)
.replace("k", k).replace("l", l)
.replace("m", m).replace("n", n)
.replace("o", o).replace("p", p)
.replace("q", q).replace("r", r)
.replace("s", s).replace("t", t)
.replace("u", u).replace("v", v)
.replace("w", w).replace("x", x)
.replace("y", y).replace("z", z);
if (enmsg != null) {
print("Message encoded to " + enmsg);
enmsg = null;
run();
} else {
}
}
if (option.equalsIgnoreCase("decode")) {
String demsg = code.readLine().toLowerCase().replace(dea, "a")
.replace(deb, "b").replace(dec, "c")
.replace(ded, "d").replace(dee, "e")
.replace(def, "f").replace(deg, "g")
.replace(deh, "h").replace(dei, "i")
.replace(dej, "j").replace(dek, "k")
.replace(del, "l").replace(dem, "m")
.replace(den, "n").replace(deo, "o")
.replace(dep, "p").replace(deq, "q")
.replace(der, "r").replace(des, "s")
.replace(det, "t").replace(deu, "u")
.replace(dev, "v").replace(dew, "w")
.replace(dex, "x").replace(dey, "y")
.replace(dez, "z");
if (demsg != null) {
print("Message decoded to " + demsg);
demsg = null;
run();
} else {
}
} else {
print("Unknown input");
System.out.println();
run();
}
}
}
public static void print(String input) {
System.out.println("[SecureMsg] " + input);
}
}