vidit_X 29 Junior Poster

I am implementing RSA in C++ and here's my design(code structure).

keygen.h

namespace rsa{
    class keygen{
        public:
        //Constructor
        keygen(size);
        //Generate keys
        void generate();
        //Getters
        string gete(){ return xyz; }
        .. 
        ..
        ..

        private:
        //initializes bignums
        void initall();
        keygen(){}
        //Private Member variables goes here
    }
}

prime.h

namespace rsa{
    //First 100 primes
    unsigned int primes[]={2,3,5,7,11.....541};

    //MillarRabin Primality
    bool isPrime(mpz_t, unsigned short);
    //Get Random Prime
    void getPrime(mpz_t, mpz_t)
}

endec.h

namespace rsa{
    //Encryption
    string encryption(string text, const string& n, const string& e);
    //Decryption
    string decryption(string cipher, const string& n, const string& d);
}

Is this a good design? How can I make it better? I want to improve the structure or the overall design, that's why dint post any implementation specific code. Things like naming standards, using classes wherever applicable, standard function signature and similar is what I'm looking for.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.