Search code examples
phpconstantsmcrypt

How to use Mcrypt constants outside Mcrypt?


How to use Mcrypt constants outside Mcrypt?

I need to call a function like: $s->encrypt(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC); but those constants only works when I call them directly into a Mcrypt function like mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');.

How can I call those constants?

Thank you


Solution

  • Actually, those are just strings:

    MCRYPT_RIJNDAEL_256: "rijndael-256"
    MCRYPT_MODE_CBC: "cbc"
    

    Try passing those strings with your function.