Class: EnigmaEncrypto::KeyGen

Inherits:
Object
  • Object
show all
Defined in:
lib/enigma_encrypto/key_gen.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeKeyGen

Returns a new instance of KeyGen.



7
8
9
10
# File 'lib/enigma_encrypto/key_gen.rb', line 7

def initialize
  rand = Random.new
  @rand_num = rand(10000..99999).to_s.split("")
end

Instance Attribute Details

#rand_numObject

Returns the value of attribute rand_num.



5
6
7
# File 'lib/enigma_encrypto/key_gen.rb', line 5

def rand_num
  @rand_num
end

Instance Method Details

#display_keyObject



16
17
18
# File 'lib/enigma_encrypto/key_gen.rb', line 16

def display_key
  (@rand_num.map{|num| num.to_i}).join
end

#initial_decryption_keys(key) ⇒ Object



20
21
22
23
# File 'lib/enigma_encrypto/key_gen.rb', line 20

def initial_decryption_keys(key)
  @rand_num = key
  generate_keys
end

#initial_rotation_keysObject



12
13
14
# File 'lib/enigma_encrypto/key_gen.rb', line 12

def initial_rotation_keys
  generate_keys
end