class EnigmaEncrypto::KeyGen

Attributes

rand_num[RW]

Public Class Methods

new() click to toggle source
# File lib/enigma_encrypto/key_gen.rb, line 7
def initialize
  rand = Random.new
  @rand_num = rand(10000..99999).to_s.split("")
end

Public Instance Methods

display_key() click to toggle source
# 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) click to toggle source
# File lib/enigma_encrypto/key_gen.rb, line 20
def initial_decryption_keys(key)
  @rand_num = key
  generate_keys
end
initial_rotation_keys() click to toggle source
# File lib/enigma_encrypto/key_gen.rb, line 12
def initial_rotation_keys
  generate_keys
end

Private Instance Methods

generate_keys() click to toggle source
# File lib/enigma_encrypto/key_gen.rb, line 27
def generate_keys
  key_values = []
  4.times do |index|
    key_values << ((@rand_num[index] + @rand_num[index + 1])).to_i
  end
  key_values
end