6 Replies Latest reply: Mar 4, 2012 9:47 AM by ptc-4476568 RSS

    RSA and Mathcad

    ptc-4476568 Copper

      I have just created some functions to calculate the public and private keys given two prime numbers. The problem is that is taking to long to cipher and decipher a simple message of 9 numbers.

      So, could anybody help me with that?

       

      Thanks

       

      Luiz Carlos

        • Re: RSA and Mathcad
          wayne Gold

          In the dcif program, I think you have a problem with the "while",  dosn't stop.

           

           

          Try the attached, I saved as M12.  It takes a while to calculate cif when saving or opening in 12, don't know why.  But in M15, this delay does not happen.

            • Re: RSA and Mathcad
              ptc-4476568 Copper

              Wayne,

               

              Thanks for your help, but the worksheet is still behaving the same way. Althought the cif and dcif programs runs and return correctly their values, at the end of the worksheet, all the functions mc and md doesn't work.

               

              Best regards,

               

              Luiz

                • Re: RSA and Mathcad
                  wayne Gold

                  Luiz,

                  For the results of the mc1, mc2, etc. you used the symbolic equal, just use the equal sign as you did for m1, m1, etc.

                   

                  For the md functions, need to do the same, however the error says that a number greater than 10^307 was encountered.  For md1, you have 217^137, similar for the others.  So I guess you need to do someting different here.

                   

                  Wayne

                    • Re: RSA and Mathcad
                      ptc-4476568 Copper

                      Wayne,

                       

                      I have just assigned the value 13 to the cif function and the sheet worked fine. As for the "break if..." you inserted in the dcif function, it didn't work. Concerning the solve operator, I have read from the mathcad forum that by using the solve operator instead of the = operator, mathcad solver is able to handle the 10 to the 307 power restriction. The worksheet is attached.

                       

                      Please, try it again and tell me what you think about.

                       

                      Thanks again,

                       

                      Luiz

                        • Re: RSA and Mathcad
                          wayne Gold

                          Luiz,

                           

                          I put the "break if"  temporarily as break in the while loop, but should have used just a limit on the number of iterations.

                           

                          with the cif=13 fixed, so just looking at the dcif function, without limit on the iterations, some valuse of p, result in very long calculation times, I gave up on p=14 (with q left the same).  Can you put a limit on the iterations, or some other iteration limit in the program for dcif

                           

                           

                          Can you put limits in cif and dcif on the magnitude in a random way?

                           

                          Those seem to be the problems, large numbers and no limits on the iterations in dcif. 

                           

                          Wayne