Class: RubyDES::Ctx
- Inherits:
-
Object
- Object
- RubyDES::Ctx
- Defined in:
- lib/ruby-des.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #decrypt ⇒ Object
- #encrypt ⇒ Object
-
#initialize(data, key) ⇒ Ctx
constructor
A new instance of Ctx.
Constructor Details
#initialize(data, key) ⇒ Ctx
Returns a new instance of Ctx.
30 31 32 33 34 35 36 37 |
# File 'lib/ruby-des.rb', line 30 def initialize(data, key) unless data.is_a?(RubyDES::Block) and key.is_a?(RubyDES::Block) raise "RubyDES::InvalidBlockFormat: Data and key must be a Block object." end @data = data @key = key end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
28 29 30 |
# File 'lib/ruby-des.rb', line 28 def data @data end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
28 29 30 |
# File 'lib/ruby-des.rb', line 28 def key @key end |
Instance Method Details
#decrypt ⇒ Object
43 44 45 |
# File 'lib/ruby-des.rb', line 43 def decrypt self.run(:decrypt) end |
#encrypt ⇒ Object
39 40 41 |
# File 'lib/ruby-des.rb', line 39 def encrypt self.run(:encrypt) end |