From: Jamis Buck Date: 2004-04-14T01:02:59+09:00 Subject: openssl ciphers This is just an update on my last message. I managed to figure out how to use the OpenSSL ciphers to do the encryption/decryption--took a little doing, but once I figured it out it was almost ridiculously easy. For future reference, here's how you do it: require 'openssl' require 'base64' cipher = OpenSSL::Cipher::DES.new password = "hullabaloo" cipher.encrypt( password ) result = cipher.update( "some text to encrypt" ) result << cipher.final puts encode64( result ) cipher.decrypt( password ) result = cipher.update( result ) result << cipher.final puts result If anyone has any suggestions for doing it better, please let me know. -- Jamis Buck jgb3@email.byu.edu http://www.jamisbuck.org/jamis ruby -h | ruby -e 'a=[];readlines.join.scan(/-(.)\[e|Kk(\S*)|le.l(..)e|#!(\S*)/) {|r| a << r.compact.first };puts "\n>#{a.join(%q/ /)}<\n\n"'