Here are examples:

Select p and q

N= p x q

PHI = (p-1) x (q-1)

e should not share a factor with PHI.

(d x e) mod PHI= 1 (use inverse mod of PHI here or if simple just loop to find d)

Public key (e,N)

Private key (d,N)

Here is inverse mod N:

And an introduction to RSA:

You are really going to struggle with 64-bit values, as you values will quick over run this.

Professor of Cryptography. Serial innovator. Believer in fairness, justice & freedom. EU Citizen. Auld Reekie native. Old World Breaker. New World Creator.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store