Class: EnigmaEncrypto::RotationNumGen
- Inherits:
-
Object
- Object
- EnigmaEncrypto::RotationNumGen
- Defined in:
- lib/enigma_encrypto/rotation_num_gen.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#showkey ⇒ Object
Returns the value of attribute showkey.
-
#today_date ⇒ Object
Returns the value of attribute today_date.
Instance Method Summary collapse
- #crack_num_arr(key, date) ⇒ Object
-
#initialize ⇒ RotationNumGen
constructor
A new instance of RotationNumGen.
- #reverse_num_array(key, date) ⇒ Object
- #rotation_num_array ⇒ Object
Constructor Details
#initialize ⇒ RotationNumGen
Returns a new instance of RotationNumGen.
10 11 12 13 14 15 16 17 |
# File 'lib/enigma_encrypto/rotation_num_gen.rb', line 10 def initialize @key_without_offset = KeyGen.new @key = @key_without_offset.initial_rotation_keys @showkey = @key_without_offset.display_key @offsetgen = DateOffsetGen.new @offset = @offsetgen.get_offset @today_date = @offsetgen.todays_date end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
8 9 10 |
# File 'lib/enigma_encrypto/rotation_num_gen.rb', line 8 def key @key end |
#offset ⇒ Object
Returns the value of attribute offset.
8 9 10 |
# File 'lib/enigma_encrypto/rotation_num_gen.rb', line 8 def offset @offset end |
#showkey ⇒ Object
Returns the value of attribute showkey.
8 9 10 |
# File 'lib/enigma_encrypto/rotation_num_gen.rb', line 8 def showkey @showkey end |
#today_date ⇒ Object
Returns the value of attribute today_date.
8 9 10 |
# File 'lib/enigma_encrypto/rotation_num_gen.rb', line 8 def today_date @today_date end |
Instance Method Details
#crack_num_arr(key, date) ⇒ Object
33 34 35 36 37 |
# File 'lib/enigma_encrypto/rotation_num_gen.rb', line 33 def crack_num_arr(key, date) @key = key @offset = date rotation_num_array end |
#reverse_num_array(key, date) ⇒ Object
27 28 29 30 31 |
# File 'lib/enigma_encrypto/rotation_num_gen.rb', line 27 def reverse_num_array(key, date) @offset = @offsetgen.get_decrypter_offset(date) @key = @key_without_offset.initial_decryption_keys(key) rotation_num_array end |
#rotation_num_array ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/enigma_encrypto/rotation_num_gen.rb', line 19 def rotation_num_array rotation_num = [] 4.times do |index| rotation_num << @key[index] + @offset[index] end rotation_num end |