Class: Nexaas::Cipher::CrypterBase

Inherits:
Object
  • Object
show all
Defined in:
lib/nexaas/cipher/crypter_base.rb

Overview

CrypterBase: abstract class to support crypter classes

Direct Known Subclasses

XorCrypter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ CrypterBase

Returns a new instance of CrypterBase.



9
10
11
# File 'lib/nexaas/cipher/crypter_base.rb', line 9

def initialize(*args)
  @salt = Salt.new(*args)
end

Instance Attribute Details

#saltObject (readonly)

Returns the value of attribute salt.



7
8
9
# File 'lib/nexaas/cipher/crypter_base.rb', line 7

def salt
  @salt
end

Instance Method Details

#decrypt(code, **options) ⇒ Object



17
18
19
# File 'lib/nexaas/cipher/crypter_base.rb', line 17

def decrypt(code, **options)
  guarded_crypt(code, :do_decrypt, **options)
end

#encrypt(code, **options) ⇒ Object



13
14
15
# File 'lib/nexaas/cipher/crypter_base.rb', line 13

def encrypt(code, **options)
  guarded_crypt(code, :do_encrypt, **options)
end

#salt?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/nexaas/cipher/crypter_base.rb', line 21

def salt?
  salt.salt?
end