Class: DCase::Crypto

Inherits:
Object
  • Object
show all
Includes:
Table
Defined in:
lib/dcase/crypto.rb

Instance Method Summary collapse

Methods included from Table

#get_table, #merge, #merge_sort, #translate

Methods included from Ext

binary_path

Constructor Details

#initialize(password) ⇒ Crypto

Returns a new instance of Crypto.



5
6
7
# File 'lib/dcase/crypto.rb', line 5

def initialize(password)
  @encrypt_table, @decrypt_table = get_table(password)
end

Instance Method Details

#decrypt(data) ⇒ Object



13
14
15
# File 'lib/dcase/crypto.rb', line 13

def decrypt(data)
  translate(@decrypt_table, data)
end

#encrypt(data) ⇒ Object



9
10
11
# File 'lib/dcase/crypto.rb', line 9

def encrypt(data)
  translate(@encrypt_table, data)
end