joelanders / enigma

Enigma and Bombe simulations.
MIT License
6 stars 0 forks source link

Help needed here #1

Closed luisfellipe7 closed 8 years ago

luisfellipe7 commented 8 years ago

Hello man, I'm trying to use your application on enigma machine to study some cases for my dissertation but I can't seen to get it working, I run enigma_spec.rb and nothing happens, help me here please.

joelanders commented 8 years ago

Here's a console session:

l@tp ~/code/enigma [master] $ irb           
irb(main):001:0> require './enigma.rb'
=> true
irb(main):002:0> e = Enigma.fromMostBasicSettings
=> #<Enigma:0x0000000093d6b8 @rotors=[#<Rotor:0x00000000948bf8 @rtol={0=>4, 1=>10, 2=>12, 3=>5, 4=>11, 5=>6, 6=>3, 7=>16, 8=>21, 9=>25, 10=>13, 11=>19, 12=>14, 13=>22, 14=>24, 15=>7, 16=>23, 17=>20, 18=>18, 19=>15, 20=>0, 21=>8, 22=>1, 23=>17, 24=>2, 25=>9, 26=>nil}, @ltor={4=>0, 10=>1, 12=>2, 5=>3, 11=>4, 6=>5, 3=>6, 16=>7, 21=>8, 25=>9, 13=>10, 19=>11, 14=>12, 22=>13, 24=>14, 7=>15, 23=>16, 20=>17, 18=>18, 15=>19, 0=>20, 8=>21, 1=>22, 17=>23, 2=>24, 9=>25}, @notches=[16]>, #<Rotor:0x00000000946c40 @rtol={0=>0, 1=>9, 2=>3, 3=>10, 4=>18, 5=>8, 6=>17, 7=>20, 8=>23, 9=>1, 10=>11, 11=>7, 12=>22, 13=>19, 14=>12, 15=>2, 16=>16, 17=>6, 18=>25, 19=>13, 20=>15, 21=>24, 22=>5, 23=>21, 24=>14, 25=>4, 26=>nil}, @ltor={0=>0, 9=>1, 3=>2, 10=>3, 18=>4, 8=>5, 17=>6, 20=>7, 23=>8, 1=>9, 11=>10, 7=>11, 22=>12, 19=>13, 12=>14, 2=>15, 16=>16, 6=>17, 25=>18, 13=>19, 15=>20, 24=>21, 5=>22, 21=>23, 14=>24, 4=>25}, @notches=[4]>, #<Rotor:0x0000000093f878 @rtol={0=>1, 1=>3, 2=>5, 3=>7, 4=>9, 5=>11, 6=>2, 7=>15, 8=>17, 9=>19, 10=>23, 11=>21, 12=>25, 13=>13, 14=>24, 15=>4, 16=>8, 17=>22, 18=>6, 19=>0, 20=>10, 21=>12, 22=>20, 23=>18, 24=>16, 25=>14, 26=>nil}, @ltor={1=>0, 3=>1, 5=>2, 7=>3, 9=>4, 11=>5, 2=>6, 15=>7, 17=>8, 19=>9, 23=>10, 21=>11, 25=>12, 13=>13, 24=>14, 4=>15, 8=>16, 22=>17, 6=>18, 0=>19, 10=>20, 12=>21, 20=>22, 18=>23, 16=>24, 14=>25}, @notches=[0]>], @positions=[0, 0, 0], @reflector=#<Reflector:0x0000000093d6e0 @rtol={0=>24, 1=>17, 2=>20, 3=>7, 4=>16, 5=>18, 6=>11, 7=>3, 8=>15, 9=>23, 10=>13, 11=>6, 12=>14, 13=>10, 14=>12, 15=>8, 16=>4, 17=>1, 18=>5, 19=>25, 20=>2, 21=>22, 22=>21, 23=>9, 24=>0, 25=>19, 26=>nil}, @ltor={24=>0, 17=>1, 20=>2, 7=>3, 16=>4, 18=>5, 11=>6, 3=>7, 15=>8, 23=>9, 13=>10, 6=>11, 14=>12, 10=>13, 12=>14, 8=>15, 4=>16, 1=>17, 5=>18, 25=>19, 2=>20, 22=>21, 21=>22, 9=>23, 0=>24, 19=>25}>>
irb(main):003:0> e.encipher_string!('thislineissecure')
=> "zpjjtafkabumibsx"
irb(main):004:0> 

Or you can run the tests in enigma_spec.rb with rspec:

l@tp ~/code/enigma [master] $ rspec enigma_spec.rb 
...........

Finished in 0.01333 seconds
11 examples, 0 failures
luisfellipe7 commented 8 years ago

Ty, when I run the rspec enigma_spec.rb this creates a file with the examples? If yes where it goes?

joelanders commented 8 years ago

It doesn't create any files with examples. I'm not sure what you mean.

luisfellipe7 commented 8 years ago

Though it did, thanks for the help :)