PPolySim OS
For Educators · RSA Encryption

RSA Encryption for a birthday attack

Built for educators teaching it to a class. Drop a live demo into a lecture or assign it as a shareable link — no lab installs. Simulate a birthday attack live below — adjust the inputs and watch it respond, right in your browser.

RSA Public-Key EncryptionLive
message
42
↓ encrypt: 42^3 mod 391
ciphertext
189
↓ decrypt: 189^235 mod 391
recovered
42

Controls

Presets

Prime p
Prime q
Message (number < n)

RSA rests on a one-way street: multiplying two big primes is easy, but factoring the product back apart is practically impossible. The public key (n, e) encrypts by raising the message to the power e mod n; only the private key d — computable only from the secret primes — can undo it. Real keys use 600-digit primes; these tiny ones just show the machinery.

▶ Run in Python

Data Inspector

Modulus n = p·q391
φ(n)352
Public key e3
Private key d235

Governing equation

Reading this result: The public key (n=391, e=3) turns 42 into ciphertext 189; only the private key d=235, derived from the secret primes, brings it back to 42. With primes this small, n could be factored instantly — real RSA uses 600-digit primes.

Runs locally in your browser — free forever. Scale to the cloud when reality gets heavy.

or unlock everything with Pro →

More with RSA Encryption

Frequently asked questions

Is this good for educators?
Yes — this version of "RSA Encryption for a birthday attack" is framed for educators teaching it to a class. Drop a live demo into a lecture or assign it as a shareable link — no lab installs.
Do I need to install anything?
No. It runs in any modern browser, free, with no account required.