# Encrypted By Ezcrypto but cannot decrypt with PHP mcrypt

**URL:** <https://www.ruby-forum.com/t/encrypted-by-ezcrypto-but-cannot-decrypt-with-php-mcrypt/88094>\
**Category:** Ruby\
**Created:** [March 8, 2007, 3:42am UTC](https://www.ruby-forum.com/t/encrypted-by-ezcrypto-but-cannot-decrypt-with-php-mcrypt/88094 "2007-03-08T03:42:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kwon37xi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/c2a13f/32.png) [@kwon37xi](https://www.ruby-forum.com/u/kwon37xi)\
**Post date:** [March 8, 2007, 3:42am UTC](https://www.ruby-forum.com/t/encrypted-by-ezcrypto-but-cannot-decrypt-with-php-mcrypt/88094/1 "2007-03-08T03:42:40Z")

</div>

Hello, I’m a Ruby newbie.

Our site is developed with Ruby On Rails mainly, but some parts use PHP  
5.  
So, in Ruby, it encrypt username with EzCrypto aes-128-cbc with a key  
and save it to browser cookie.  
But cannot decrypt the cookie with PHP5’s mcrypt RIJNDAEL128 CBC  
algorithm with the same key.  
(AFAIK RIJNDAEL128 == AES, am I right??)  
How can I decrypt the value which is encrypted with EzCrypto?  
I don’t have to use aes-128-cbc.

Would you recomend any algorithm good for this kind problem?

Regards,

---

<div class="post-metadata">

**Author:** ![kwon37xi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/c2a13f/32.png) [@kwon37xi](https://www.ruby-forum.com/u/kwon37xi)\
**Post date:** [March 8, 2007, 9:24am UTC](https://www.ruby-forum.com/t/encrypted-by-ezcrypto-but-cannot-decrypt-with-php-mcrypt/88094/2 "2007-03-08T09:24:52Z")

</div>

I solved the problem with aes-128-ecb in EzCrypto, and  
MCRYPT\_RIJNDAEL\_128, MCRYPT\_MODE\_ECB in PHP.

Kwonnam Son wrote:

> Hello, I’m a Ruby newbie.
> 
> Our site is developed with Ruby On Rails mainly, but some parts use PHP  
> 5.  
> So, in Ruby, it encrypt username with EzCrypto aes-128-cbc with a key  
> and save it to browser cookie.  
> But cannot decrypt the cookie with PHP5’s mcrypt RIJNDAEL128 CBC  
> algorithm with the same key.  
> (AFAIK RIJNDAEL128 == AES, am I right??)  
> How can I decrypt the value which is encrypted with EzCrypto?  
> I don’t have to use aes-128-cbc.
> 
> Would you recomend any algorithm good for this kind problem?
> 
> Regards,
