Choosing p , q to rectify mod problems :


We encrypt by calculating message X (mod pq).  In practice, we are forced to break X into a series of smaller packets, and encrypt these packets individually.  Otherwise X could be an arbitrarily large integer, which becomes difficult to deal with.  Our current version uses base-10 numbers, and we are forced to fix the size of the packet to some number of digits.  We chose 8 for our packet size.  This means that our packets can only represent numbers from 0 to .  Therefore, we would like to choose pq to be as close to this number as possible.  If 200,000,000, we would encrypt just fine.   However, on decryption, we could obtain a packet with value more than 99,999,999.   In fact, these “overflowed packets” would become very common, if we assume each packet value to be equally likely.  A full one half of all of the packets we receive would fail to be correctly decrypted. This would lead to a 50% packet loss and an incomprehensible message.  By carefully choosing p and q, we can eliminate almost all of the packet loss and maintain a better exchange of packets.  For example, take  pq = (10061)(9941) = 100,016,401.  This allows only 16,402 packets in 100,000,000 to be mistranslated, which is 0.016402% packet loss, a great improvement.  This is why we have chosen these primes as our default values in the program.


If we were to manipulate packets in binary, our pq must be near a power of two, which is much simpler to find.  Primes of the form  and  are well known.  Naturally, a product of primes of these forms together would be reasonably close to a power of two.  The problem with choosing primes in this manner is that, given a public key, finding such formulaic primes to break the encryption would be much simpler than finding other primes.