@Test public void runTest() { assertEquals("MBQFHQVPFNEQCAQY", Playfair.playfair("HELLOWORLDTEST", "ISFAIR", true, Mode.ENCRYPT)); assertEquals("HELXLOWORLDTESTX", Playfair.playfair("MBQFHQVPFNEQCAQY", "ISFAIR", true, Mode.DECRYPT)); }
public static String playfair(String inputText, String key, Boolean replaceJI, final Mode mode) { try { inputText = inputText.toUpperCase(); key = key.toUpperCase(); String output = null; createTable(key, replaceJI); if (mode == Mode.ENCRYPT) { output = encode(prepareText(inputText, replaceJI)); } if (mode == Mode.DECRYPT) { output = decode(inputText); } return output; } catch (Exception e) { return e.toString(); } }
Playfair { public static String playfair(String inputText, String key, Boolean replaceJI, final Mode mode) { try { inputText = inputText.toUpperCase(); key = key.toUpperCase(); String output = null; createTable(key, replaceJI); if (mode == Mode.ENCRYPT) { output = encode(prepareText(inputText, replaceJI)); } if (mode == Mode.DECRYPT) { output = decode(inputText); } return output; } catch (Exception e) { return e.toString(); } } }
Playfair { public static String playfair(String inputText, String key, Boolean replaceJI, final Mode mode) { try { inputText = inputText.toUpperCase(); key = key.toUpperCase(); String output = null; createTable(key, replaceJI); if (mode == Mode.ENCRYPT) { output = encode(prepareText(inputText, replaceJI)); } if (mode == Mode.DECRYPT) { output = decode(inputText); } return output; } catch (Exception e) { return e.toString(); } }  }
Playfair { public static String playfair(String inputText, String key, Boolean replaceJI, final Mode mode) { try { inputText = inputText.toUpperCase(); key = key.toUpperCase(); String output = null; createTable(key, replaceJI); if (mode == Mode.ENCRYPT) { output = encode(prepareText(inputText, replaceJI)); } if (mode == Mode.DECRYPT) { output = decode(inputText); } return output; } catch (Exception e) { return e.toString(); } }  static void main(String[] args); static String playfair(String inputText, String key, Boolean replaceJI, final Mode mode); }
Playfair { public static String playfair(String inputText, String key, Boolean replaceJI, final Mode mode) { try { inputText = inputText.toUpperCase(); key = key.toUpperCase(); String output = null; createTable(key, replaceJI); if (mode == Mode.ENCRYPT) { output = encode(prepareText(inputText, replaceJI)); } if (mode == Mode.DECRYPT) { output = decode(inputText); } return output; } catch (Exception e) { return e.toString(); } }  static void main(String[] args); static String playfair(String inputText, String key, Boolean replaceJI, final Mode mode);  }