From: Jim flip Date: 2007-06-15T18:09:54+09:00 Subject: Re: ezcrypto here's some basic code that will encrypt a file with blowfish and CBC, note it doesn't do the last block of the file that is less than 8 bytes. require 'openssl' key = "1234567812345678" alg = "BF-CBC" iv = "00000000" bf = OpenSSL::Cipher::Cipher.new(alg) bf.encrypt bf.key = key bf.iv = iv File.open("openssl.dat",'wb') do |enc| File.open("test.txt","rb") do |f| size = File.size("test.txt") blocks = size / 8 for i in 1..blocks r = f.read(8) cipher = bf.update(r) enc << cipher end end enc << bf.final end You can also speed it up by doing more efficient read from file, anyhoo Openssl file encryption with Blowfish seems ok, I can get back on with the work I'm meant to be doing now :) Jim. -- Posted via http://www.ruby-forum.com/.