Method: Filenc#initialize

Defined in:
lib/filenc.rb

#initialize(o) ⇒ Filenc

Returns a new instance of Filenc.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/filenc.rb', line 8

def initialize(o)
  # Set Strong phrase value for @key > 32 and @iv > 16
  @key = ''
  @iv = ''
  # Default Algorithm set to AES-256-CBC
  @algo = 'AES-256-CBC'
  @file = o[:file]
  @opt = o
  raise "initialize @key and @iv values (@iv>15,@key>31 for AES-256-CBS)" if @key == '' or @iv == '' 
  raise "initialize @iv>15 & @key>31 for AES-256-CBS" if @algo == 'AES-256-CBC' and ( @key.length < 32 or @iv.length < 16 )
end