Sha256: 6aa3723d3816e57e2852e466404db49b49d236f69242cdacb52ea1ad204f4420

Contents?: true

Size: 575 Bytes

Versions: 5

Compression:

Stored size: 575 Bytes

Contents

# A fake class that does no encryption
module CryptKeeper
  module Provider
    class FakeEncryptor
      def initialize(*args)
      end
    end
  end
end

# This class embeds the passphrase in the beginning of the string
# and then reverses the 'plaintext'
module CryptKeeper
  module Provider
    class Encryptor
      def initialize(options = {})
        @passphrase = options[:passphrase]
      end

      def encrypt(data)
        @passphrase + data.reverse
      end

      def decrypt(data)
        data.sub(/^#{@passphrase}/, '').reverse
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
crypt_keeper-0.8.0 spec/support/encryptors.rb
crypt_keeper-0.7.0 spec/support/encryptors.rb
crypt_keeper-0.6.1 spec/support/encryptors.rb
crypt_keeper-0.6.0 spec/support/encryptors.rb
crypt_keeper-0.5.0 spec/support/encryptors.rb