Class: Cipher::Skip32
- Inherits:
-
Object
- Object
- Cipher::Skip32
- Defined in:
- lib/cipher/skip32.rb
Overview
A 32-bit version of the SKIPJACK cipher. This interface is not intended to be compatible with the OpenSSL::Cipher modules.
Defined Under Namespace
Classes: Error
Instance Method Summary collapse
-
#block_size ⇒ Integer
Returns the block size.
-
#decrypt(block) ⇒ String
Decrypts
block
and returns the result. -
#encrypt(block) ⇒ String
Encrypts
block
and returns the result. -
#initialize(key) ⇒ Skip32
constructor
A new instance of Skip32.
-
#inspect ⇒ String
Returns a string representation of the object.
-
#key_len ⇒ Integer
Returns the key length.
Constructor Details
Instance Method Details
#block_size ⇒ Integer
Returns the block size
43 44 45 |
# File 'lib/cipher/skip32.rb', line 43 def block_size 4 end |
#decrypt(block) ⇒ String
Decrypts block
and returns the result
29 30 31 32 33 |
# File 'lib/cipher/skip32.rb', line 29 def decrypt(block) buffer = unpack(block) skip32(@key, buffer, false) pack(buffer) end |
#encrypt(block) ⇒ String
Encrypts block
and returns the result
20 21 22 23 24 |
# File 'lib/cipher/skip32.rb', line 20 def encrypt(block) buffer = unpack(block) skip32(@key, buffer, true) pack(buffer) end |
#inspect ⇒ String
Returns a string representation of the object
37 38 39 |
# File 'lib/cipher/skip32.rb', line 37 def inspect "#<Cipher::Skip32:#{object_id}>" end |
#key_len ⇒ Integer
Returns the key length
49 50 51 |
# File 'lib/cipher/skip32.rb', line 49 def key_len 10 end |