MCPcopy Create free account
hub / github.com/TheAlgorithms/Java / f

Method f

src/main/java/com/thealgorithms/ciphers/Blowfish.java:1155–1167  ·  view source on GitHub ↗
(String plainText)

Source from the content-addressed store, hash-verified

1153 The outputs are added modulo 232 and XORed to produce the final 32-bit output
1154 */
1155 private String f(String plainText) {
1156 String[] a = new String[4];
1157 String ans = "";
1158 for (int i = 0; i < 8; i += 2) {
1159 // column number for S-box is a 8-bit value
1160 long col = Long.parseUnsignedLong(hexToBin(plainText.substring(i, i + 2)), 2);
1161 a[i / 2] = sBox[i / 2][(int) col];
1162 }
1163 ans = addBin(a[0], a[1]);
1164 ans = xor(ans, a[2]);
1165 ans = addBin(ans, a[3]);
1166 return ans;
1167 }
1168
1169 // generate subkeys
1170 private void keyGenerate(String key) {

Callers 1

roundMethod · 0.95

Calls 3

hexToBinMethod · 0.95
addBinMethod · 0.95
xorMethod · 0.95

Tested by

no test coverage detected