Sha256: 0284183a9c14f013d55bbfc34176e431beacb834778f312ec49f0a355a67d77c

Contents?: true

Size: 548 Bytes

Versions: 6

Compression:

Stored size: 548 Bytes

Contents

# $Date: 2009/02/18 00:41:54 $
require 'yaml'
require 'rubygems'
require 'crypt/blowfish'

class IOCrypt
  def initialize(passphrase)
    @blowfish = Crypt::Blowfish.new(passphrase[0..55])  
  end

  def load(dumpfile)
    data = nil

    File.open(dumpfile,'r'){|fh|
      data = YAML.load( @blowfish.decrypt_string( fh.read ) )
    }

    return data
  end

  def dump(dumpfile, data)
    count = nil

    File.open(dumpfile,'w') do |fh|
      count = fh.write( @blowfish.encrypt_string( YAML.dump( data ) ) )
    end

    return count
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gtk2passwordapp-0.0.6 lib/iocrypt.rb
gtk2passwordapp-0.0.1 lib/iocrypt.rb
gtk2passwordapp-0.0.2 lib/iocrypt.rb
gtk2passwordapp-0.0.3 lib/iocrypt.rb
gtk2passwordapp-0.0.4 lib/iocrypt.rb
gtk2passwordapp-0.0.5 lib/iocrypt.rb