Sha256: 10c8c20a25ff68f49c727b57b9e89d1236ec60316498ed82ab353b68ee718077

Contents?: true

Size: 580 Bytes

Versions: 6

Compression:

Stored size: 580 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.to_s.sub(/^#{@passphrase}/, '').reverse
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
crypt_keeper-0.13.1 spec/support/encryptors.rb
crypt_keeper-0.13.0 spec/support/encryptors.rb
crypt_keeper-0.12.0 spec/support/encryptors.rb
crypt_keeper-0.11.0 spec/support/encryptors.rb
crypt_keeper-0.10.0.pre spec/support/encryptors.rb
crypt_keeper-0.9.0.pre spec/support/encryptors.rb