1 Reply Latest reply on Mar 11, 2009 1:19 PM by Newsgroup_User

    MySQL encrypted password checking

    jboyle217
      Hi,

      I'm working with an application that has parts written in perl and parts written in ColdFusion, and the data is stored in an MySQL database. Our user admin functions have been written in perl, and passwords are encrypted by MySQL's 'encrypt' function when entered into the database. To do password verification, after retrieving the encrypted password from the database, the perl code calls 'crypt' in the following manner:

      [...]
      if (crypt($enteredPWD, $encryptedPWD) NE $encryptedPWD) {
      [...]
      }
      [...]

      I now need to do the same checking in ColdFusion (i.e. encrypt the entered password and compare that to the encrypted password in the database). I've been working with the 'Decrypt' and 'Encrypt' functions and am unable to get the functionality I need. The perl 'crypt' function is 'DES' based so that's what I've been using as the 'algorithm' in the functions. I've also tried 'CMFC_COMPAT' with no success.

      Is what I need to do possible, and if so, what am I missing?

      Thanks in advance,

      Jim
        • 1. Re: MySQL encrypted password checking
          Level 7
          jboyle217 wrote:
          > I now need to do the same checking in ColdFusion (i.e. encrypt the entered
          > password and compare that to the encrypted password in the database). I've
          > been working with the 'Decrypt' and 'Encrypt' functions and am unable to get
          > the functionality I need. The perl 'crypt' function is 'DES' based so that's
          > what I've been using as the 'algorithm' in the functions. I've also tried
          > 'CMFC_COMPAT' with no success.
          >
          > Is what I need to do possible, and if so, what am I missing?

          There's a java implementation of the crypt function somewhere on the net
          (I don't have the link anymore). You'll need to download the java
          source, compile it, place the class file in CF classpath and then use
          the java class from CF.

          --
          Mack