brutus 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/brutus.rb +24 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac1696d631b8808ef39719d2e61a52d182d8d25c
|
4
|
+
data.tar.gz: 0ea3f56691518b858c46dfe1d91cf24177c838c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bd6035fa89104d8fbecabc27bd512efaa89830bd3187dbec3f58c2350d323281c93d45bea2b7c8e28c9606db1854f7c45f6af37780d0c29ba452ca576adfed8
|
7
|
+
data.tar.gz: e4b121ce08224dc45a73fef6f1bc9fa5fd69eb70cd23a3fe1a70208298dc931da03ebc1f23abf5ac9bdd5a025790c34778dfa895c6c534fd4706435931a1387a
|
data/lib/brutus.rb
CHANGED
@@ -2,10 +2,14 @@ require 'digest'
|
|
2
2
|
|
3
3
|
class Brutus
|
4
4
|
|
5
|
-
def self.
|
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)
|