Why does RSA produce different outputs for the same string using the same public key? RRS feed

  • Question

  • I am currently using the RSACrypto class with 2048 bit.  Whenever I encrypt the same password, it will come out different at different times.  So I login to the program online, and use the RSA to pass my password for verification to a webservice.  Then I save the encrypted result locally.  Next time I open up my program and encrypt the login prompt password, it is different than my cached byte array.  In addition to that, if I try encrypting the same string three times in a row in code, the result is different each time. 

    Anyone make sense of this madness?  :-S  I need a way to cache the last successful login password without providing private key access.  I had hoped I could compare encrypted results to verify offline access.  Thanks.
    Tuesday, May 20, 2008 7:07 PM


  • I found this link that says a random number is used in the RSA encryption algorithm.  Looks like I will have to settle for less and stored the cached password with symetric encryption. 


    Wednesday, May 21, 2008 2:25 PM