Skip to content

Commit

Permalink
still working on cracking.
Browse files Browse the repository at this point in the history
  • Loading branch information
gijolopez committed Feb 8, 2018
1 parent aa9deae commit 8e510b2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
20 changes: 20 additions & 0 deletions lib/crack.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'pry'
class Crack
attr_reader :encrypted_message,
:date
Expand All @@ -7,4 +8,23 @@ def initialize(encrypted_message,
@encrypted_message = encrypted_message
@date = date
end

def alphabet
['a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l',
'm', 'n', 'o', 'p', 'q', 'r',
's', 't', 'u', 'v', 'w', 'x',
'y', 'z', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9',
' ', '.', ',']
end



# def compare_position
# (alphabet.index('.') - 2) - alphabet.index(@encrypted_message) + 7
# # binding.pry
# #encryted - decrypted position
# # return value
# end
end
3 changes: 3 additions & 0 deletions lib/encryptor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,6 @@ def encrypt
encrypted_message.join
end
end

encryptor = Encryptor.new('the ..end..', '12345', '070218')
puts encryptor.encrypt
11 changes: 8 additions & 3 deletions test/crack_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ def test_it_can_pass_encrypted_message
assert_equal '070218', crack.date
end

def test_can_compare_encrypted_and_decrypted_index_position
crack = Crack.new('5', '070218')
# def test_can_compare_encrypted_and_decrypted_index_position
# crack = Crack.new(',9bhr0bxw08', '070218')
#
# assert_equal 18, crack.compare_position
# end

assert_equal 3, crack.compare_position
def test_remainder_in_encrypted_message
crack = Crack.new(',9bhr0bxw08', '070218')

assert_equal
end
end

0 comments on commit 8e510b2

Please sign in to comment.