File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
main/java/com/thealgorithms/ciphers
test/java/com/thealgorithms/ciphers Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 5
5
* identically for both uppercase and lowercase letters.
6
6
* It's a symmetric cipher, meaning applying it twice returns the original text.
7
7
* Hence, the encrypting and the decrypting functions are identical
8
- *
9
8
* @author https://github.com/Krounosity
10
9
* Learn more: https://en.wikipedia.org/wiki/Atbash
11
10
*/
@@ -55,15 +54,18 @@ public String convert() {
55
54
for (char ch : toConvert .toCharArray ()) {
56
55
57
56
// If the character is smallcased.
58
- if (isSmall (ch ))
57
+ if (isSmall (ch )) {
59
58
convertedString .append ((char ) ('z' - (ch - 'a' )));
59
+ }
60
60
// If the character is capital cased.
61
- else if (isCapital (ch ))
61
+ else if (isCapital (ch )) {
62
62
convertedString .append ((char ) ('Z' - (ch - 'A' )));
63
+ }
63
64
// Non-alphabetical character.
64
- else
65
+ else {
65
66
convertedString .append (ch );
67
+ }
66
68
}
67
69
return convertedString .toString ();
68
70
}
69
- }
71
+ }
Original file line number Diff line number Diff line change @@ -27,4 +27,4 @@ public void atbashDecrypt() {
27
27
28
28
assertEquals (expectedText , encryptToNormal .getString ());
29
29
}
30
- }
30
+ }
You can’t perform that action at this time.
0 commit comments