Module: EasyEncryption

Defined in:
lib/easy_encryption.rb,
lib/easy_encryption/version.rb,
lib/easy_encryption/class_methods.rb,
lib/easy_encryption/instance_methods.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Constant Summary collapse

CREATE_CIPHER =

lambda for creating Gibberish ciphers

lambda do |cipher_key|

  if cipher_key == @last_cipher_key
    # no cipher has been created or cipher_key is the same
    @cipher = Gibberish::AES.new cipher_key
  else
    # cipher_key was changed
    @cipher = Gibberish::AES.new cipher_key
  end
  
  # remember the cipher key to determine if a new cipher
  # needs to be created on the next call
  @last_cipher_key = cipher_key
  # return the cipher
  @cipher
end
VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.cipher_keyObject

getter for the default cipher key



17
18
19
# File 'lib/easy_encryption.rb', line 17

def self.cipher_key
  @cipher_key
end

.cipher_key=(cipher_key) ⇒ Object

setter to change the default cipher key



22
23
24
# File 'lib/easy_encryption.rb', line 22

def self.cipher_key=(cipher_key)
  @cipher_key = cipher_key
end

.setup(cipher_key) ⇒ Object

sets up EasyEncryption



9
10
11
12
13
14
# File 'lib/easy_encryption.rb', line 9

def self.setup(cipher_key)
  @cipher_key = cipher_key
  String.send :include, InstanceMethods
  String.send :extend, ClassMethods
  true
end