Class: CryptoToolchain::Tools::MT19937SeedRecoverer
- Defined in:
- lib/crypto_toolchain/tools/mt_19937_seed_recoverer.rb
Instance Attribute Summary collapse
-
#extracted ⇒ Object
readonly
Returns the value of attribute extracted.
-
#finish ⇒ Object
readonly
Returns the value of attribute finish.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
Instance Method Summary collapse
-
#default_start ⇒ Object
One hour ago.
- #execute ⇒ Object
-
#initialize(extracted, start: default_start, finish: Time.now.to_i) ⇒ MT19937SeedRecoverer
constructor
A new instance of MT19937SeedRecoverer.
Constructor Details
#initialize(extracted, start: default_start, finish: Time.now.to_i) ⇒ MT19937SeedRecoverer
Returns a new instance of MT19937SeedRecoverer.
4 5 6 7 8 |
# File 'lib/crypto_toolchain/tools/mt_19937_seed_recoverer.rb', line 4 def initialize(extracted, start: default_start, finish: Time.now.to_i) @extracted = extracted @start = start @finish = finish end |
Instance Attribute Details
#extracted ⇒ Object (readonly)
Returns the value of attribute extracted.
19 20 21 |
# File 'lib/crypto_toolchain/tools/mt_19937_seed_recoverer.rb', line 19 def extracted @extracted end |
#finish ⇒ Object (readonly)
Returns the value of attribute finish.
19 20 21 |
# File 'lib/crypto_toolchain/tools/mt_19937_seed_recoverer.rb', line 19 def finish @finish end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
19 20 21 |
# File 'lib/crypto_toolchain/tools/mt_19937_seed_recoverer.rb', line 19 def start @start end |
Instance Method Details
#default_start ⇒ Object
One hour ago
22 23 24 |
# File 'lib/crypto_toolchain/tools/mt_19937_seed_recoverer.rb', line 22 def default_start Time.now.to_i - (3600) end |
#execute ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/crypto_toolchain/tools/mt_19937_seed_recoverer.rb', line 10 def execute (start..finish).each do |seed| if CryptoToolchain::Utilities::MT19937.new(seed).extract == extracted return seed end end raise RuntimeError, "Did not find the seed; consider expanding start and finish" end |