mcrypt not working

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matt McKay

    mcrypt not working

    I've written a php page which allows users to type in a text string and a
    key, then choose from a dropdown menu of encryption/decryption cyphers, and
    a method (encrypt, decrypt).

    The whole thing works, except the mcrypt command doesn't work.

    here is my mcrypt command:
    if ($method == 0) {
    //Encrypt
    $output = mcrypt_ecb ($algorithm, $key, $input, MCRYPT_ENCRYPT) ;
    } else {
    //Decrypt
    $output = mcrypt_ecb ($algorithm, $key, $input, MCRYPT_DECRYPT) ;
    }



    Here's a list of what the variables may be:
    $algorithm = MCRYPT_3DES
    $key = "plain text"
    $input = "more plain text"

    if you want, I can upload a .txt containing the whole php file.

    Thanks! :)


  • André Næss

    #2
    Re: mcrypt not working

    Matt McKay:
    [color=blue]
    > I've written a php page which allows users to type in a text string and a
    > key, then choose from a dropdown menu of encryption/decryption cyphers,
    > and a method (encrypt, decrypt).
    >
    > The whole thing works, except the mcrypt command doesn't work.[/color]

    "Doesn't work" isn't really helpful :) Do you actually have support for the
    mcrypt library in your PHP?

    André Næss

    Comment

    • Randell D.

      #3
      Re: mcrypt not working


      "Matt McKay" <someone@micros oft.com> wrote in message
      news:D4oqb.1808 52$bo1.46748@ne ws-server.bigpond. net.au...[color=blue]
      > I've written a php page which allows users to type in a text string and a
      > key, then choose from a dropdown menu of encryption/decryption cyphers,[/color]
      and[color=blue]
      > a method (encrypt, decrypt).
      >
      > The whole thing works, except the mcrypt command doesn't work.
      >
      > here is my mcrypt command:
      > if ($method == 0) {
      > //Encrypt
      > $output = mcrypt_ecb ($algorithm, $key, $input, MCRYPT_ENCRYPT) ;
      > } else {
      > //Decrypt
      > $output = mcrypt_ecb ($algorithm, $key, $input, MCRYPT_DECRYPT) ;
      > }
      >
      >
      >
      > Here's a list of what the variables may be:
      > $algorithm = MCRYPT_3DES
      > $key = "plain text"
      > $input = "more plain text"
      >
      > if you want, I can upload a .txt containing the whole php file.
      >
      > Thanks! :)
      >
      >[/color]

      You need to let us know what you mean by "doesn't work"...

      Either way - its been a while since I used the mcrypt functions, but when I
      did, there were a few things I should (but hadn't done) and a newsposter
      here guided me:

      1 - Have you installed the mcrypt *development* library? Note, I had
      installed libmcrypt on my box - I had *incorrectly* believed that the
      development version of libmcrypt was sorta like an alpha or beta release -
      It wasn't... Because I was programming, the development version has the
      libraries that PHP would use when being compiled... Which leads me to my
      last question...

      2 - You did compile PHP with --with-mcrypt didn't you?

      Hope that helps... its from memory but I believe it to be correct...

      randelld


      Comment

      Working...