style: format code (#4212)

close #4204
This commit is contained in:
acbin
2023-06-09 18:52:05 +08:00
committed by GitHub
parent ad03086f54
commit 00282efd8b
521 changed files with 5233 additions and 7309 deletions

View File

@@ -15,8 +15,7 @@ class AffineCipher {
{here x is msg[i] and m is 26} and added 'A' to
bring it in range of ascii alphabet[ 65-90 | A-Z ] */
if (msg[i] != ' ') {
cipher =
cipher + (char) ((((a * (msg[i] - 'A')) + b) % 26) + 'A');
cipher = cipher + (char) ((((a * (msg[i] - 'A')) + b) % 26) + 'A');
} else { // else simply append space character
cipher += msg[i];
}
@@ -29,8 +28,8 @@ class AffineCipher {
int a_inv = 0;
int flag = 0;
//Find a^-1 (the multiplicative inverse of a
//in the group of integers modulo m.)
// Find a^-1 (the multiplicative inverse of a
// in the group of integers modulo m.)
for (int i = 0; i < 26; i++) {
flag = (a * i) % 26;
@@ -45,12 +44,8 @@ class AffineCipher {
{here x is cipher[i] and m is 26} and added 'A'
to bring it in range of ASCII alphabet[ 65-90 | A-Z ] */
if (cipher.charAt(i) != ' ') {
msg =
msg +
(char) (
((a_inv * ((cipher.charAt(i) + 'A' - b)) % 26)) + 'A'
);
} else { //else simply append space character
msg = msg + (char) (((a_inv * ((cipher.charAt(i) + 'A' - b)) % 26)) + 'A');
} else { // else simply append space character
msg += cipher.charAt(i);
}
}
@@ -67,8 +62,6 @@ class AffineCipher {
System.out.println("Encrypted Message is : " + cipherText);
// Calling Decryption function
System.out.println(
"Decrypted Message is: " + decryptCipher(cipherText)
);
System.out.println("Decrypted Message is: " + decryptCipher(cipherText));
}
}