///////////////////////////////////////////////////////////////////////////// // File: RsaReadMe // Contents: Changes made to the C++ rsa program, originally created by M. // Kennedy, Fall 1995, modified by R. Hannebohn in Spring 1997. // Functions written in the revised version by Ron Hannebohn have (RH) written somewhere in the function header. In general, new comments added were used with the C++ comments: // The changes made to the rsa program are as follows: --------------------------------------------------- 1. Created an rsa.H file, since there were numerous constants and functions defined. 2. Fixed a bug with the Pollard Rho factoring option; for many of the numbers it would just run until the max time expired, even for small numbers like 12. This does not mean it is completely perfect; for some numbers it still gives a wrong answer (try 8); but this is from the complexity of the Pollard-Rho algorithm. Most likely it is because of the starting values of a and b, which is always one. 3. Added a "current list of primes". When the program starts, it generates an initial list of primes, and each time the prime generation option is chosen, the list is replaced. This is for the options of computing N or phi(N), where two prime factors must be entered by the user. The user is only allowed to enter factors that are currently in the prime list. This keeps the user from entering factors that may be composite, but doesn't require them to go through prime number generation first. If the user does enter numbers not in the current list (for more than 2 tries), the current list of probabilistic primes is displayed for them, so they can enter correct input. --the max size of the list is 750, which is 5000/(ln 5000) plus a "just in case" amount. The interval where the number of primes is found is 5000. --two function involved with the new current primes list include InPrimeList(a search function), and DisplayPrimeList. 4. The function GetPositiveInt is a helper function that was added since the same code was used many times in the original version. It does what the function name says. 5. More "coordination" between the options was added. No matter what the current status of the program is, the user will never have to perform one option before another. --For computing N, the user inputs 2 primes that must be from the current list of primes. The list will be displayed for the user if the user's input fails (this is done every 3 turns, as explained above.) Each time a new N is computed, phi(N) will be reset to the "not computed" status. --For computing phi(N), the user must enter appropriate input (the same as for computing N). When phi(N) is calculated, N is calculated by taking the product of the 2 given factors. This is to ensure that N and phi(N)'s current values are compatible. --Choosing a random encryption exponent requires the value of phi(N). If this has not been calculated, the user is prompted for two prime factors to calculate phi(N), which also calculates N. The decryption exponent is also calculated automatically by calling the inverse function. In essence, all values in the RSA cryptosystem--N, phi(N), e, and d may be calculated with this option. --the mod inverse option used to take the result and store it in d; now it just displays the inverse that was calculated, but does not store it in the decryption exponent value d. --In summary, the options relating to the RSA cryptosystem are generating and displaying the prime list, compute N, compute phi(N), choose e, and display N/Phi/e/d. The remaining options are utilities for working with large numbers.