Class: EnigmaEncrypto::KeyGen
- Inherits:
-
Object
- Object
- EnigmaEncrypto::KeyGen
- Defined in:
- lib/enigma_encrypto/key_gen.rb
Instance Attribute Summary collapse
-
#rand_num ⇒ Object
Returns the value of attribute rand_num.
Instance Method Summary collapse
- #display_key ⇒ Object
- #initial_decryption_keys(key) ⇒ Object
- #initial_rotation_keys ⇒ Object
-
#initialize ⇒ KeyGen
constructor
A new instance of KeyGen.
Constructor Details
#initialize ⇒ KeyGen
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_num ⇒ Object
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_key ⇒ Object
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_keys ⇒ Object
12 13 14 |
# File 'lib/enigma_encrypto/key_gen.rb', line 12 def initial_rotation_keys generate_keys end |