spec/support/encryptors.rb in crypt_keeper-0.4.2 vs spec/support/encryptors.rb in crypt_keeper-0.5.0
- old
+ new
@@ -1,26 +1,29 @@
# A fake class that does no encryption
-module CryptKeeperProviders
- class FakeEncryptor
- def initialize(*args)
+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 CryptKeeperProviders
- class Encryptor
- def initialize(options = {})
- @passphrase = options[:passphrase]
- end
+module CryptKeeper
+ module Provider
+ class Encryptor
+ def initialize(options = {})
+ @passphrase = options[:passphrase]
+ end
- def encrypt(data)
- @passphrase + data.reverse
- end
+ def encrypt(data)
+ @passphrase + data.reverse
+ end
- def decrypt(data)
- data.sub(/^#{@passphrase}/, '').reverse
+ def decrypt(data)
+ data.sub(/^#{@passphrase}/, '').reverse
+ end
end
end
end
-