I have been thinking on this method but did not really get into it because I thought it was stupid to do for some reason, maybe because I've never heard of it and it's pretty obvious. But today I got a little more into it and thought about it.
If I want to securely speak with a mate on the Internet with a program I made specially for this, which only we have. The program makes my computer connect to his computer or vice-verse and transfer data.
Now the thing is, to make it simple, let's say we only use English language without any symbols, just lower-case characters.
We can set for example that a
will equal to gH5S
and so on, and at the end we will receive a long text of gibberish, and on top of that we will have an RSA encryption before it's sent out.
I understand, the hacker after decrypting the RSA data he can split the text into pieces that repeat itself like the gH5S
but there are many characters used, how can he know which split is what character? He needs to guess the words and somehow be sure, and there are tons of possibilities to build words.
There's an example simple program in Java to explain this:
public class Test {
static String[] replacements = new String[] {
"abK98", "HGD3x", "aRfXZ", "hdZdgb", "eDzfh", "aieSZ3", "iLz5",
"zH4", "ab98", "abK2398", "a5568", "ACz98", "loW91", "ZmKuJ",
"azS6D", "ZcfZS", "dFXze", "FszXF", "rXzFttX", "fdXRS", "52aF",
"ZaWRQ", "qPweQ", "dWtQY", "puEz", "ZdeA"
};
static String space = "lKi89";
public static void main (String[] args) throws java.lang.Exception
{
StringBuilder encrypted = new StringBuilder();
String text = "hello i really like to program and be on stackexchange";
for (int i = 0 ; i < text.length(); i++) {
char c = text.charAt(i);
if (c == ' ') {
encrypted = encrypted.append(space);
continue;
}
int idx = Character.getNumericValue(c) - 10;
encrypted = encrypted.append(replacements[idx]);
}
System.out.println(encrypted.toString());
}
}
The replacements
array, first index is a
and last one is z
by order.
And this is the output:
zH4eDzfhACz98ACz98azS6DlKi89ab98lKi89FszXFeDzfhabK98ACz98ACz98puEzlKi89ACz98ab98a5568eDzfhlKi89fdXRSazS6DlKi89ZcfZSFszXFazS6DiLz5FszXFabK98loW91lKi89abK98ZmKuJhdZdgblKi89HGD3xeDzfhlKi89azS6DZmKuJlKi89rXzFttXfdXRSabK98aRfXZa5568eDzfhdWtQYaRfXZzH4abK98ZmKuJiLz5eDzfh
Is that a bad method? can this be easily decrypted by spying on the data? How?