This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Add below into config/application.rb: | |
| # | |
| # config.middleware.use 'RequestLogger' | |
| # | |
| class RequestLogger | |
| def initialize app | |
| @app = app | |
| end | |
| def call(env) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Plugboard = Hash[*('A'..'Z').to_a.sample(20)] | |
| Plugboard.merge!(Plugboard.invert) | |
| Plugboard.default_proc = proc { |_, key| key } | |
| def build_a_rotor | |
| Hash[('A'..'Z').zip(('A'..'Z').to_a.shuffle)] | |
| end | |
| ROTOR_1, ROTOR_2, ROTOR_3 = build_a_rotor, build_a_rotor, build_a_rotor |