File.open("test.enc",'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

    if size%8 >0
      r = f.read((size%8))
      cipher = bf.update(r)
      enc << cipher
    end
  end

  enc << bf.final
end

That does the trick, I think the bf.final should sort out the padding.
In fact I wouldn't be surprised if you didn't have to feed update 8 
bytes at a time, but not tested...NOTE: this is just test code that 
works, and isn't efficient.

Jim.

-- 
Posted via http://www.ruby-forum.com/.