style: enable NeedBraces in checkstyle (#5227)

* enable style NeedBraces

* style: enable NeedBraces in checkstyle

---------

Co-authored-by: Samuel Facchinello <samuel.facchinello@piksel.com>
This commit is contained in:
Samuel Facchinello
2024-06-13 21:00:16 +02:00
committed by GitHub
parent 51fcc66345
commit 87b17e0571
68 changed files with 629 additions and 261 deletions

View File

@ -1104,7 +1104,9 @@ public class Blowfish {
private String binToHex(String binary) {
long num = Long.parseUnsignedLong(binary, 2);
String hex = Long.toHexString(num);
while (hex.length() < (binary.length() / 4)) hex = "0" + hex;
while (hex.length() < (binary.length() / 4)) {
hex = "0" + hex;
}
return hex;
}
@ -1120,7 +1122,9 @@ public class Blowfish {
a = hexToBin(a);
b = hexToBin(b);
String ans = "";
for (int i = 0; i < a.length(); i++) ans += (char) (((a.charAt(i) - '0') ^ (b.charAt(i) - '0')) + '0');
for (int i = 0; i < a.length(); i++) {
ans += (char) (((a.charAt(i) - '0') ^ (b.charAt(i) - '0')) + '0');
}
ans = binToHex(ans);
return ans;
}
@ -1202,7 +1206,9 @@ public class Blowfish {
// generating key
keyGenerate(key);
for (int i = 0; i < 16; i++) plainText = round(i, plainText);
for (int i = 0; i < 16; i++) {
plainText = round(i, plainText);
}
// postprocessing
String right = plainText.substring(0, 8);
@ -1224,7 +1230,9 @@ public class Blowfish {
// generating key
keyGenerate(key);
for (int i = 17; i > 1; i--) cipherText = round(i, cipherText);
for (int i = 17; i > 1; i--) {
cipherText = round(i, cipherText);
}
// postprocessing
String right = cipherText.substring(0, 8);

View File

@ -31,7 +31,9 @@ public class A5KeyStreamGenerator extends CompositeLFSR {
}
public BitSet getNextKeyStream() {
for (int cycle = 1; cycle <= INITIAL_CLOCKING_CYCLES; ++cycle) this.clock();
for (int cycle = 1; cycle <= INITIAL_CLOCKING_CYCLES; ++cycle) {
this.clock();
}
BitSet result = new BitSet(KEY_STREAM_LENGTH);
for (int cycle = 1; cycle <= KEY_STREAM_LENGTH; ++cycle) {

View File

@ -19,7 +19,9 @@ public abstract class CompositeLFSR implements BaseLFSR {
boolean result = false;
for (var register : registers) {
result ^= register.getLastBit();
if (register.getClockBit() == majorityBit) register.clock();
if (register.getClockBit() == majorityBit) {
register.clock();
}
}
return result;
}