From: Rodrigo Dominguez Date: 2006-09-23T06:01:16+09:00 Subject: cryptography (RSA) I trying to do some cryptography between ruby and php, I don't get it!!!! ruby code: --------------------------------------------- #!/usr/bin/env ruby require 'openssl' text = "abcdefghijklmnopqrstuvwxyz" key = "altakey" alg = "AES-128-ECB" puts %(clear text: "#{text}") puts %(symmetric key: "#{key}") puts %(cipher alg: "#{alg}") puts "--Encrypting--" des = OpenSSL::Cipher::Cipher.new(alg) des.encrypt(key) cipher = des.update(text) cipher << des.final puts %(encrypted text: #{cipher.inspect}) puts --------------------------------------------- This is the result: "\214\t\303n\320Lz\330\271\252\017\355\036\251|\237\212V\270hq\267X\204\261\3327t\345\353\324\364" --------------------------------------------- what is that? \214????\t\303n? this is the php code: ----------------------------------------------- ----------------------------------------------- this is the result: ������dg[0l?��g��������C��(Ayy2��ze��t A��e:vb��Uu<��` ��%fi��`cz������ ----------------------------------------------- wtf???? ----------------------------------------------- by the way, this is a code to encrypt in php ----------------------------------------------- ---------------------------------------------- this is the result: 1fce1c90530b80a27b1af29364ba45759870f1a2341c380dcc48845335d9e575 ---------------------------------------------- how can I manage that hex data in ruby? any help on anything? -- Posted via http://www.ruby-forum.com/.