CT899

The RSA Encryptor: Encrypt and Decrypt Messages

HardAcceptance: 0.0%

The Royal Cryptography Bureau of Prime City has implemented the RSA encryption system. Given a public key (n, e) and a private key d, you must encrypt and decrypt messages. Encryption: c = m^e mod n. Decryption: m = c^d mod n. "The security of RSA depends on the difficulty of factoring n," the Bureau Chief explains. "But the math is simple: just modular exponentiation. Encrypt a message with the public key, then decrypt it with the private key." Given n, e, d, and a message m, output the encrypted ciphertext c = m^e mod n, then decrypt it back m' = c^d mod n. Output c and m' separated by a space. Verify m' equals m. Constraints: 1 <= m < n <= 10^9, 1 <= e, d <= 10^9 Input: 3233 17 2753 65 Output: 2790 65 Input: 33 3 7 2 Output: 8 2

Constraints:

1 <= m < n <= 10^9, 1 <= e, d <= 10^9

Tags:

rsa encryption modular-exponentiation cryptography modular-arithmetic math
Loading...
Test Cases:No test cases
No test cases available.
The RSA Encryptor: Encrypt and Decrypt Messages - HARD Coding Problem | CodeTikki