Module: BlockMethods

Included in:
Crypt::Blowfish, Crypt::Gost
Defined in:
lib/crypt/block_methods.rb

Instance Method Summary collapse

Instance Method Details

#decrypt_block(block) ⇒ Object



10
11
12
13
14
15
# File 'lib/crypt/block_methods.rb', line 10

def decrypt_block(block)
  xl, xr = block.unpack('NN')
  xl, xr = decrypt_pair(xl, xr)
  decrypted = [xl, xr].pack('NN')
  return(decrypted)
end

#encrypt_block(block) ⇒ Object



2
3
4
5
6
7
# File 'lib/crypt/block_methods.rb', line 2

def encrypt_block(block)
  xl, xr = block.unpack('NN')
  xl, xr = encrypt_pair(xl, xr)
  encrypted = [xl, xr].pack('NN')
  return(encrypted)
end