Sha256: bba6de788b3cc0f879b75e58873d239b8e438d9ef2280dfa5738c830f432cc4d
Contents?: true
Size: 605 Bytes
Versions: 7
Compression:
Stored size: 605 Bytes
Contents
require 'yaml' require 'rubygems' begin require 'crypt_tea' rescue Exception # above is what works, but documentation shows this... require 'crypt-tea' end module Gtk2PasswordApp class IOCrypt LENGTH = 15 def initialize(passphrase) @key = Crypt::XXTEA.new(passphrase[0..LENGTH]) end def load(dumpfile) data = nil File.open(dumpfile,'r'){|fh| data = YAML.load( @key.decrypt( fh.read ) ) } return data end def dump(dumpfile, data) count = nil File.open(dumpfile,'w') { |fh| count = fh.write( @key.encrypt( YAML.dump( data ) ) ) } return count end end end
Version data entries
7 entries across 7 versions & 1 rubygems