If I write the following code
mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $raw, MCRYPT_MODE_CBC, $iv);
How to write in ruby?
If I write the following code
mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $raw, MCRYPT_MODE_CBC, $iv);
How to write in ruby?
You can use the openssl library for this. I think what you need is here for symmetric key encryption:
http://stuff-things.net/2008/02/05/encrypting-lots-of-sensitive-data-with-ruby-on-rails/
Here is Ruby equivalent using OpenSSL,
cipher = OpenSSL::Cipher::Cipher.new("aes-128-cbc")
cipher.encrypt
cipher.key = key
cipher.iv = iv
encrypted = cipher.update(raw)
encrypted << cipher.final