brutus 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/brutus.rb +24 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c14bb3c5a85a188f8b9e4c942ed6cfec859d5ab
4
- data.tar.gz: dcb0d3c06b387d6983ede4d88cc9b214d44345aa
3
+ metadata.gz: ac1696d631b8808ef39719d2e61a52d182d8d25c
4
+ data.tar.gz: 0ea3f56691518b858c46dfe1d91cf24177c838c0
5
5
  SHA512:
6
- metadata.gz: 4608e4d2f869153f1d5ac13d7acacb643e37e87b8eb4d0d272c4ce18327d7bfc7eb01538655ac07c9b223aa8c743ea6da20643460c4408ffad1aeecaacfd0229
7
- data.tar.gz: 3a5b4038c4d98dc1a7e8c96a476ec95d2d7c5c5aacebd2070c6b698d47c6a30faebdddacf27f27e46c347c648ad771055f77422d21f5a9d1c29b1add91bc5e21
6
+ metadata.gz: 7bd6035fa89104d8fbecabc27bd512efaa89830bd3187dbec3f58c2350d323281c93d45bea2b7c8e28c9606db1854f7c45f6af37780d0c29ba452ca576adfed8
7
+ data.tar.gz: e4b121ce08224dc45a73fef6f1bc9fa5fd69eb70cd23a3fe1a70208298dc931da03ebc1f23abf5ac9bdd5a025790c34778dfa895c6c534fd4706435931a1387a
@@ -2,10 +2,14 @@ require 'digest'
2
2
 
3
3
  class Brutus
4
4
 
5
- def self.decipher(key, digest)
5
+ def self.decipher_letters(key, digest)
6
6
  find_letter_match(key, digest)
7
7
  end
8
8
 
9
+ def self.decipher_numbers(key, digest)
10
+ find_number_match(key, digest)
11
+ end
12
+
9
13
  def self.cipher(key, message)
10
14
  find_key(key).hexdigest(message)
11
15
  end
@@ -14,8 +18,25 @@ class Brutus
14
18
 
15
19
  def self.digest_match?(digest, comparer_digest)
16
20
  digest == comparer_digest
17
- end
21
+ end
18
22
 
23
+ def self.find_number_match(key, digest)
24
+ current_number = 0
25
+ new_digest = cipher(key, current_number.to_s)
26
+ current_thousands = 1000
27
+ puts "currently searching through #{current_number % 1000} to #{current_thousands}"
28
+
29
+ while !digest_match?(digest, new_digest)
30
+ current_number += 1
31
+ new_digest = cipher(key, current_number.to_s)
32
+
33
+ if current_number == current_thousands
34
+ puts "currently searching through #{current_number % 1000} to #{current_thousands}"
35
+ current_thousands += 1000
36
+ end
37
+ end
38
+ puts "THE PASSWORD IS #{current_number}"
39
+ end
19
40
 
20
41
  def self.find_letter_match(key, digest)
21
42
  current_letter = "a"
@@ -32,7 +53,7 @@ class Brutus
32
53
  end
33
54
  end
34
55
 
35
- current_letter
56
+ puts "THE PASSWORD IS: #{current_letter}"
36
57
  end
37
58
 
38
59
  def self.find_key(key)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brutus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Ancheta