Class: DES::Ctx
- Inherits:
-
Object
- Object
- DES::Ctx
- Defined in:
- lib/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.
23 24 25 26 27 28 29 30 |
# File 'lib/des.rb', line 23 def initialize(data, key) unless data.is_a?(DES::Block) and key.is_a?(DES::Block) raise 'DES::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.
21 22 23 |
# File 'lib/des.rb', line 21 def data @data end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
21 22 23 |
# File 'lib/des.rb', line 21 def key @key end |
Instance Method Details
#decrypt ⇒ Object
36 37 38 |
# File 'lib/des.rb', line 36 def decrypt self.run(:decrypt) end |
#encrypt ⇒ Object
32 33 34 |
# File 'lib/des.rb', line 32 def encrypt self.run(:encrypt) end |