src/com/michaelho/RandomizedAlgorithms/RA2.java
/**
         * The implementation of RSA encryption, which requires public key.
         *
         * @param message The message to be encrypted.
         * @param publicKeyPair The public key pair which must have n (=p*q) and e.
         *
         * @return the encrypted message as a double.
         * */
The implementation of RSA encryption, which requires public key.
@param message The message to be encrypted.
@param publicKeyPair The public key pair which must have n (=p*q) and e.

@return the encrypted message as a double.
The implementation of RSA encryption which requires public key . @param message The message to be encrypted . @param publicKeyPair The public key pair which must have n ( = p * q ) and e . @return the encrypted message as a double .
double encrypt(Double message, int[] publicKeyPair) {
            int n = publicKeyPair[0];
            int e = publicKeyPair[1];
            return ra1.ma.modularExp(message.intValue(), e, n);
        }
double encrypt ( Double message , int [ ] publicKeyPair ) { int n = publicKeyPair [ 0 ] ; int e = publicKeyPair [ 1 ] ; return ra1 . ma . modularExp ( message . intValue ( ) , e , n ) ; }
The implementation of RSA encryption, which requires public key.
The implementation of RSA encryption which requires public key .
// Encryption c = (msg ^ e) % n