/**
 * Project RSA Algorithm.
 * Copyright Michał Szczygieł.
 * Created at Feb 24, 2014.
 */

/**
 * TODO COMMENTS MISSING!
 * 
 * @author Michał Szczygieł <michal.szczygiel@wp.pl>
 * 
 */
public class RSA {

}

@@ -1,12 +1,77 @@
+import java.math.BigInteger;%0Aimport java.security.SecureRandom;%0A%0A
 /**%0A * Proje
@@ -164,29 +164,72 @@
  * T
-ODO COMMENTS MISSING!
+his class represents implementation of RSA encryption algorithm.
 %0A * 
@@ -311,9 +311,3369 @@
 RSA 
-%7B
+implements Encryption %7B%0A%0A    /**%0A     * The base for the operation.%0A     */%0A    private static final Integer BASE = 27;%0A%0A    /**%0A     * Field keeps the value of the multiplication of numbers p and q.%0A     */%0A    private BigInteger n;%0A%0A    /**%0A     * Field stores private key for RSA encryption algorithm.%0A     */%0A    private BigInteger privateKey;%0A%0A    /**%0A     * Field stores public key for RSA encryption algorithm.%0A     */%0A    public BigInteger publicKey;%0A%0A    /**%0A     * The constructor for %7B@link RSA%7D. This method create an instance that can%0A     * both encrypt and decrypt.%0A     * %0A     * @param bits%0A     *            The bits size for RSA key.%0A     */%0A    public RSA(Integer bits) %7B%0A        SecureRandom r = new SecureRandom();%0A%0A        BigInteger p = new BigInteger(bits, 100, r); // Large prime number%0A        BigInteger q = new BigInteger(bits, 100, r); // Large prime number%0A        BigInteger e = euler(p, q); // Field stores value of Euler operations%0A                                    // for p and q, where p and q are large%0A                                    // prime numbers.%0A%0A        n = p.multiply(q);%0A        publicKey = new BigInteger(Integer.toString(r.nextInt()));%0A%0A        while (e.gcd(publicKey).intValue() %3E 1) %7B%0A            publicKey = publicKey.add(BigInteger.ONE);%0A        %7D%0A%0A        privateKey = publicKey.modInverse(e);%0A    %7D%0A%0A    /**%0A     * This method makes operation to achieve decrypted message.%0A     * %0A     * @param valueToDecrypt%0A     *            The value of which will be performed the decryption process.%0A     * @return Decrypted value.%0A     */%0A    public synchronized BigInteger decrypt(BigInteger valueToDecrypt) %7B%0A        return valueToDecrypt.modPow(privateKey, n);%0A    %7D%0A%0A    /**%0A     * This method makes operation to achieve decrypted message.%0A     * %0A     * @param messageToDecrypt%0A     *            The message of which will be performed the decryption process.%0A     * @return Decrypted message.%0A     */%0A    public synchronized String decrypt(String messageToDecrypt) %7B%0A        return new String((new BigInteger(messageToDecrypt)).modPow(privateKey,%0A                n).toByteArray());%0A    %7D%0A%0A    /**%0A     * This method makes operation to create encrypted message.%0A     * %0A     * @param valueToEncrypt%0A     *            The value of which will be performed the encryption process%0A     * @return Encrypted value.%0A     */%0A    public synchronized BigInteger encrypt(BigInteger valueToEncrypt) %7B%0A        return valueToEncrypt.modPow(publicKey, n);%0A    %7D%0A%0A    /**%0A     * This method makes operation to create encrypted message.%0A     * %0A     * @param messageToEncrypt%0A     *            The message of which will be performed the encryption process%0A     * @return Encrypted message.%0A     */%0A    public synchronized String encrypt(String messageToEncrypt) %7B%0A        return (new BigInteger(messageToEncrypt.getBytes())).modPow(publicKey,%0A                n).toString();%0A    %7D%0A%0A    /**%0A     * Gets value of Euler for p and q, where p and q are large prime numbers.%0A     * %0A     * @param p%0A     *            The large prime number.%0A     * @param q%0A     *            The large prime number.%0A     * @return The value of Euler operations for p and q.%0A     */%0A    private BigInteger euler(BigInteger p, BigInteger q) %7B%0A        return (p.subtract(BigInteger.ONE)).multiply((q%0A                .subtract(BigInteger.ONE)));%0A    %7D
 %0A%0A%7D%0A

Create implementation for RSA encryption algorithm