Java icon indicating copy to clipboard operation
Java copied to clipboard

[OTHER] Java Implementation of Playfair Cipher

Open enrico-zini opened this issue 1 year ago • 1 comments

What would you like to share?

Issue: https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/ciphers/ProductCipher.java The shifting of the characters is constant, but it should be determined by user input.

Solution: Substitute '5' for 'n'

Additional information

`System.out.println("Enter a number: "); int n = sc.nextInt();

    // Substitution encryption
    StringBuffer substitutionOutput = new StringBuffer();
    for (int i = 0; i < substitutionInput.length(); i++) {
        char c = substitutionInput.charAt(i);
        substitutionOutput.append((char) (c + 5)); // <---- should be n instead of 5
    } ...
    StringBuffer plaintext = new StringBuffer();
    for (int i = 0; i < transpositionPlaintext.length(); i++) {
        char c = transpositionPlaintext.charAt(i);
        plaintext.append((char) (c - 5)); // <---- same here
    }

enrico-zini avatar Jan 23 '24 14:01 enrico-zini

Is it still open? Shall I work on it?

SarthakChaudhary46 avatar Feb 02 '24 06:02 SarthakChaudhary46

hie are you working on it? is it open?

shrvya-shetty avatar Feb 09 '24 12:02 shrvya-shetty

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution!

github-actions[bot] avatar Mar 11 '24 00:03 github-actions[bot]

Please reopen this issue once you have made the required changes. If you need help, feel free to ask in our Discord server or ping one of the maintainers here. Thank you for your contribution!

github-actions[bot] avatar Mar 19 '24 00:03 github-actions[bot]