$_SESSION["userpwd"] = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($cryptokey), $_POST[''password''], MCRYPT_MODE_CBC, md5(md5($cryptokey))));; Thanks. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
carlo bation wrote in post #994454:> $_SESSION["userpwd"] = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, > md5($cryptokey), $_POST[''password''], MCRYPT_MODE_CBC, > md5(md5($cryptokey))));;Maybe this article will help: http://blog.rapleaf.com/dev/2009/02/19/ruby-and-mcrypt/ As it says at the top of the article there is usually little reason to need mcrypt with Ruby. Instead Ruby contains an OpenSSL implementation that should provided all the crypto functions without the need for additional crypto libraries. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Friday, April 22, 2011 2:09:08 AM UTC-6, Ruby-Forum.com User wrote:> > $_SESSION["userpwd"] = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, > md5($cryptokey), $_POST[''password''], MCRYPT_MODE_CBC, > md5(md5($cryptokey))));; > > Thanks. >I don''t know if you just need help doing equivalent crypto operations in ruby, or if you need something that is binary-compatible with the above code (to have a ruby and php app. inter-operate for example). If you just need equivalent crypto/encoding operations then I''d use OpenSSL (through the OpenSSL gem). MD5 hashing is available through Digest::MD5 (require ''digest/md5''). Base64 encoding/decoding can be done through the Base64 module. However, if you need to have the exact, binary-compatible ruby equivalent, then you need to be aware (if using OpenSSL) that mcrypt doesn''t do PKCS-style padding (it just zero-pads if I remember correctly). This bit me when making a rails app. that had to read and write roundcube (a php app) session data and so if you''re doing something similar, you''ll want to be aware of the fact. You can tell OpenSSL to zero-pad if you need to: http://www.ruby-forum.com/topic/208273 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Friday, April 22, 2011 11:54:00 AM UTC-6, Kendall Gifford wrote:> > > ... then I''d use OpenSSL (through the OpenSSL gem). > > Woops, did I say OpenSSL gem? That''d be the OpenSSL class in the standardlibrary: http://www.ruby-doc.org/stdlib/libdoc/openssl/rdoc/index.html -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Apr 22, 6:56 pm, Kendall Gifford <zettab...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Friday, April 22, 2011 11:54:00 AM UTC-6, Kendall Gifford wrote: > > > ... then I''d use OpenSSL (through the OpenSSL gem). > > > Woops, did I say OpenSSL gem? That''d be the OpenSSL class in the standard > > library:http://www.ruby-doc.org/stdlib/libdoc/openssl/rdoc/index.htmlThe ezcrypto gem is way easier to use, unless you happen to be used to using the openssl C api Fred -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Friday, April 22, 2011 1:01:28 PM UTC-6, Frederick Cheung wrote:> > > > The ezcrypto gem is way easier to use, unless you happen to be used to > using the openssl C api > > FredYeah, I''d agree with that (used it on one project a while back). I couldn''t remember the name of it though. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.