Choose a pair of prime numbersConvert the message to an integer
Generally, done with random choice followed by probabilistic primality testing. Call them p and q. Choose BIG numbers.Compute a modulus
m = pqChose an public exponent
Chose an exponent e such that e < m and e is relatively prime to (p-1)(q-1). The public key is the pair (m, e).Choose a private exponent
Chose an exponent d such that (ed-1) is divisible by (p-1)(q-1). The private key is the key (m,d).
Easy, just use the ASCII values; the bytes stored on the disk.Encrypting and Decrypting
cyphertext = plaintext^e mod n
plaintext = cyphertext^d mod n