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

Method decrypt

src/main/java/com/thealgorithms/ciphers/Blowfish.java:1229–1243  ·  view source on GitHub ↗

This method returns plaintext for the ciphertext passed as the first parameter decoded using the key passed as the second parameter @param String ciphertext is the text which is to be decrypted @param String key is the key which is to be used for generating cipher text @return String plainText is t

(String cipherText, String key)

Source from the content-addressed store, hash-verified

1227 * @return String plainText is the decrypted text
1228 */
1229 String decrypt(String cipherText, String key) {
1230 // generating key
1231 keyGenerate(key);
1232
1233 for (int i = 17; i > 1; i--) {
1234 cipherText = round(i, cipherText);
1235 }
1236
1237 // postprocessing
1238 String right = cipherText.substring(0, 8);
1239 String left = cipherText.substring(8, 16);
1240 right = xor(right, subKeys[1]);
1241 left = xor(left, subKeys[0]);
1242 return left + right;
1243 }
1244}

Callers

nothing calls this directly

Calls 3

keyGenerateMethod · 0.95
roundMethod · 0.95
xorMethod · 0.95

Tested by

no test coverage detected