quick_cipher 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +14 -0
- data/Rakefile +11 -0
- data/lib/quick_cipher.rb +11 -0
- data/lib/quick_cipher/decipher.rb +25 -0
- data/lib/quick_cipher/encipher.rb +15 -0
- data/quick_cipher.gemspec +29 -0
- data/readme.mdown +23 -0
- data/spec/decipher_spec.rb +19 -0
- data/spec/encipher_spec.rb +14 -0
- data/spec/formatters/compact_progressbar_formatter.rb +149 -0
- data/spec/rcov.opts +1 -0
- data/spec/sample_data/deciphered.txt +147 -0
- data/spec/sample_data/enciphered.txt +147 -0
- data/spec/spec.opts +7 -0
- data/spec/spec_helper.rb +3 -0
- metadata +89 -0
data/Manifest
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Rakefile
|
2
|
+
lib/quick_cipher.rb
|
3
|
+
lib/quick_cipher/decipher.rb
|
4
|
+
lib/quick_cipher/encipher.rb
|
5
|
+
readme.mdown
|
6
|
+
spec/decipher_spec.rb
|
7
|
+
spec/encipher_spec.rb
|
8
|
+
spec/formatters/compact_progressbar_formatter.rb
|
9
|
+
spec/rcov.opts
|
10
|
+
spec/sample_data/deciphered.txt
|
11
|
+
spec/sample_data/enciphered.txt
|
12
|
+
spec/spec.opts
|
13
|
+
spec/spec_helper.rb
|
14
|
+
Manifest
|
data/Rakefile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'echoe'
|
4
|
+
|
5
|
+
Echoe.new('quick_cipher', '0.0.1') do |p|
|
6
|
+
p.description = 'A tool for quickly enciphering/deciphering text using basic alphabet transposition.'
|
7
|
+
p.url = 'http://github.com/PatrickTulskie/quick_cipher'
|
8
|
+
p.author = 'Patrick Tulskie'
|
9
|
+
p.email = 'PatrickTulskie@gmail.com'
|
10
|
+
p.ignore_pattern = ['tmp/*']
|
11
|
+
end
|
data/lib/quick_cipher.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
class QuickCipher
|
2
|
+
module Decipher
|
3
|
+
|
4
|
+
def decipher(input_text, known_cipher = nil)
|
5
|
+
character_shift = known_cipher || determine_cipher(input_text)
|
6
|
+
input_text.each_char.map do |char|
|
7
|
+
ALPHABET.include?(char.downcase) ? ALPHABET[ALPHABET.index(char.downcase) - character_shift] : char
|
8
|
+
end.join('')
|
9
|
+
end
|
10
|
+
|
11
|
+
def decipher_file(input_file, known_cipher = nil)
|
12
|
+
decipher(File.open(input_file).read, known_cipher)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def determine_cipher(input_text)
|
18
|
+
letter_count = Hash.new { |hsh, key| hsh[key] = 0 }
|
19
|
+
input_text.each_char { |char| letter_count[char.downcase] += 1 if ALPHABET.include?(char) }
|
20
|
+
e_replacement = letter_count.index(letter_count.values.max)
|
21
|
+
ALPHABET.index(e_replacement) - 4 # subtract the index of e
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class QuickCipher
|
2
|
+
module Encipher
|
3
|
+
|
4
|
+
def encipher(input_text, number)
|
5
|
+
input_text.each_char.map do |char|
|
6
|
+
ALPHABET.include?(char.downcase) ? ALPHABET[(ALPHABET.index(char.downcase) + number) % ALPHABET.length] : char
|
7
|
+
end.join('')
|
8
|
+
end
|
9
|
+
|
10
|
+
def encipher_file(input_file, number)
|
11
|
+
encipher(File.open(input_file).read, number)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{quick_cipher}
|
5
|
+
s.version = "0.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Patrick Tulskie"]
|
9
|
+
s.date = %q{2012-01-25}
|
10
|
+
s.description = %q{A tool for quickly enciphering/deciphering text using basic alphabet transposition.}
|
11
|
+
s.email = %q{PatrickTulskie@gmail.com}
|
12
|
+
s.extra_rdoc_files = ["lib/quick_cipher.rb", "lib/quick_cipher/decipher.rb", "lib/quick_cipher/encipher.rb"]
|
13
|
+
s.files = ["Rakefile", "lib/quick_cipher.rb", "lib/quick_cipher/decipher.rb", "lib/quick_cipher/encipher.rb", "readme.mdown", "spec/decipher_spec.rb", "spec/encipher_spec.rb", "spec/formatters/compact_progressbar_formatter.rb", "spec/rcov.opts", "spec/sample_data/deciphered.txt", "spec/sample_data/enciphered.txt", "spec/spec.opts", "spec/spec_helper.rb", "Manifest", "quick_cipher.gemspec"]
|
14
|
+
s.homepage = %q{http://github.com/PatrickTulskie/quick_cipher}
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Quick_cipher", "--main", "readme.mdown"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = %q{quick_cipher}
|
18
|
+
s.rubygems_version = %q{1.5.3}
|
19
|
+
s.summary = %q{A tool for quickly enciphering/deciphering text using basic alphabet transposition.}
|
20
|
+
|
21
|
+
if s.respond_to? :specification_version then
|
22
|
+
s.specification_version = 3
|
23
|
+
|
24
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
25
|
+
else
|
26
|
+
end
|
27
|
+
else
|
28
|
+
end
|
29
|
+
end
|
data/readme.mdown
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# QuickCipher
|
2
|
+
|
3
|
+
## What is it?
|
4
|
+
|
5
|
+
QuickCipher can quickly and easily do transposition ciphers. It also has the ability to decipher giant blocks of text for which the character shift is unknown. Currently, QuickCipher only supports basic lowercase alphabet ciphering. QuickCipher supports any plain text file that can be read in, character by character.
|
6
|
+
|
7
|
+
## How does it work?
|
8
|
+
|
9
|
+
To encipher a document, simply do the following:
|
10
|
+
|
11
|
+
number_to_shift = 15
|
12
|
+
results = QuickCipher.encipher_file(path_to_file, number_to_shift)
|
13
|
+
|
14
|
+
To decipher a document:
|
15
|
+
|
16
|
+
results = QuickCipher.decipher_file(path_to_file)
|
17
|
+
|
18
|
+
Note: QuickCipher needs a sizable chunk of text in order to decipher it automatically. See below for more examples...
|
19
|
+
|
20
|
+
## More examples
|
21
|
+
|
22
|
+
>> QuickCipher.encipher("The quick brown fox jumped over the big lazy dog.", 15)
|
23
|
+
=> "iwt fjxrz qgdlc udm yjbets dktg iwt qxv apon sdv."
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Desipher" do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@test_file_location = File.expand_path(File.join(File.dirname(__FILE__), 'sample_data', 'enciphered.txt'))
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should automatically decipher a file" do
|
10
|
+
results = QuickCipher.decipher_file(@test_file_location)
|
11
|
+
results.should include("chapter i. down the rabbit-hole")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should decipher a string using a known cipher" do
|
15
|
+
results = QuickCipher.decipher("iwt fjxrz qgdlc udm yjbets dktg iwt qxv apon sdv.", 15)
|
16
|
+
results.should == "the quick brown fox jumped over the big lazy dog."
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Encipher" do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@test_file_location = File.expand_path(File.join(File.dirname(__FILE__), 'sample_data', 'deciphered.txt'))
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should encipher a file" do
|
10
|
+
results = QuickCipher.encipher_file(@test_file_location, 15)
|
11
|
+
results.should include("rwpeitg x. sdlc iwt gpqqxi-wdat")
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,149 @@
|
|
1
|
+
# Copyright (c) 2008 Nicholas A. Evans
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'spec/runner/formatter/base_text_formatter'
|
23
|
+
require "rubygems"
|
24
|
+
require 'progressbar'
|
25
|
+
|
26
|
+
module Spec
|
27
|
+
module Runner
|
28
|
+
module Formatter
|
29
|
+
class CompactProgressBarFormatter < BaseTextFormatter
|
30
|
+
# Threshold for slow specs, in seconds.
|
31
|
+
# Anything that takes longer than this will be printed out
|
32
|
+
#THRESHOLD = 0.25
|
33
|
+
THRESHOLD = 5.0
|
34
|
+
|
35
|
+
attr_reader :total, :current
|
36
|
+
|
37
|
+
def start(example_count)
|
38
|
+
@current = 0
|
39
|
+
@total = example_count
|
40
|
+
@error_state = :all_passing
|
41
|
+
@pbar = ProgressBar.new("#{example_count} examples", example_count, output)
|
42
|
+
end
|
43
|
+
|
44
|
+
def example_started(example)
|
45
|
+
super
|
46
|
+
@start_time = Time.now
|
47
|
+
end
|
48
|
+
|
49
|
+
def example_passed(example)
|
50
|
+
print_warning_if_slow(example_group.description,
|
51
|
+
example.description,
|
52
|
+
Time.now - @start_time)
|
53
|
+
increment
|
54
|
+
end
|
55
|
+
|
56
|
+
# third param is optional, because earlier versions of rspec sent only two args
|
57
|
+
def example_pending(example, message, pending_caller=nil)
|
58
|
+
immediately_dump_pending(example.__full_description, message, pending_caller)
|
59
|
+
mark_error_state_pending
|
60
|
+
increment
|
61
|
+
end
|
62
|
+
|
63
|
+
def example_failed(example, counter, failure)
|
64
|
+
immediately_dump_failure(counter, failure)
|
65
|
+
mark_error_state_failed
|
66
|
+
increment
|
67
|
+
end
|
68
|
+
|
69
|
+
def start_dump
|
70
|
+
with_color do
|
71
|
+
@pbar.finish
|
72
|
+
end
|
73
|
+
output.flush
|
74
|
+
end
|
75
|
+
|
76
|
+
def dump_failure(*args)
|
77
|
+
# no-op; we summarized failures as we were running
|
78
|
+
end
|
79
|
+
|
80
|
+
def method_missing(sym, *args)
|
81
|
+
# ignore
|
82
|
+
end
|
83
|
+
|
84
|
+
# stolen and slightly modified from BaseTextFormatter#dump_failure
|
85
|
+
def immediately_dump_failure(counter, failure)
|
86
|
+
erase_current_line
|
87
|
+
output.print "#{counter.to_s}) "
|
88
|
+
output.puts colourise("#{failure.header}\n#{failure.exception.message}", failure)
|
89
|
+
output.puts format_backtrace(failure.exception.backtrace)
|
90
|
+
output.puts
|
91
|
+
end
|
92
|
+
|
93
|
+
# stolen and modified from BaseTextFormatter#dump_pending
|
94
|
+
def immediately_dump_pending(desc, msg, called_from)
|
95
|
+
erase_current_line
|
96
|
+
output.puts yellow("PENDING SPEC:") + " #{desc} (#{msg})"
|
97
|
+
output.puts " Called from #{called_from}" if called_from
|
98
|
+
end
|
99
|
+
|
100
|
+
def increment
|
101
|
+
with_color do
|
102
|
+
@current += 1
|
103
|
+
# HACK: need to make sure the progress is printed, even when the bar hasn't changed
|
104
|
+
@pbar.instance_variable_set("@previous", 0)
|
105
|
+
@pbar.instance_variable_set("@title", "#{current}/#{total}")
|
106
|
+
@pbar.inc
|
107
|
+
end
|
108
|
+
output.flush
|
109
|
+
end
|
110
|
+
|
111
|
+
ERROR_STATE_COLORS = {
|
112
|
+
:all_passing => "\e[32m", # green
|
113
|
+
:some_pending => "\e[33m", # yellow
|
114
|
+
:some_failed => "\e[31m", # red
|
115
|
+
}
|
116
|
+
|
117
|
+
def with_color
|
118
|
+
use_color = colour? && output_to_tty?
|
119
|
+
output.print ERROR_STATE_COLORS[@error_state] if use_color
|
120
|
+
yield
|
121
|
+
output.print "\e[0m" if use_color
|
122
|
+
end
|
123
|
+
|
124
|
+
def mark_error_state_failed
|
125
|
+
@error_state = :some_failed
|
126
|
+
end
|
127
|
+
|
128
|
+
def mark_error_state_pending
|
129
|
+
@error_state = :some_pending unless @error_state == :some_failed
|
130
|
+
end
|
131
|
+
|
132
|
+
def erase_current_line
|
133
|
+
output.print "\e[K"
|
134
|
+
end
|
135
|
+
|
136
|
+
def print_warning_if_slow(group, example, elapsed)
|
137
|
+
if elapsed > THRESHOLD
|
138
|
+
#mark_error_state(:pending)
|
139
|
+
erase_current_line
|
140
|
+
output.print yellow("SLOW SPEC: #{sprintf("%.4f", elapsed)} ")
|
141
|
+
output.print " #{group} #{example}"
|
142
|
+
output.puts
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
data/spec/rcov.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--exclude "spec/*,gems/*,lib/authenticated_test_helper.rb,lib/guid.rb"
|
@@ -0,0 +1,147 @@
|
|
1
|
+
chapter i. down the rabbit-hole
|
2
|
+
|
3
|
+
alice was beginning to get very tired of sitting by her sister on the
|
4
|
+
bank, and of having nothing to do: once or twice she had peeped into the
|
5
|
+
book her sister was reading, but it had no pictures or conversations in
|
6
|
+
it, 'and what is the use of a book,' thought alice 'without pictures or
|
7
|
+
conversation?'
|
8
|
+
|
9
|
+
so she was considering in her own mind (as well as she could, for the
|
10
|
+
hot day made her feel very sleepy and stupid), whether the pleasure
|
11
|
+
of making a daisy-chain would be worth the trouble of getting up and
|
12
|
+
picking the daisies, when suddenly a white rabbit with pink eyes ran
|
13
|
+
close by her.
|
14
|
+
|
15
|
+
there was nothing so very remarkable in that; nor did alice think it so
|
16
|
+
very much out of the way to hear the rabbit say to itself, 'oh dear!
|
17
|
+
oh dear! i shall be late!' (when she thought it over afterwards, it
|
18
|
+
occurred to her that she ought to have wondered at this, but at the time
|
19
|
+
it all seemed quite natural); but when the rabbit actually took a watch
|
20
|
+
out of its waistcoat-pocket, and looked at it, and then hurried on,
|
21
|
+
alice started to her feet, for it flashed across her mind that she had
|
22
|
+
never before seen a rabbit with either a waistcoat-pocket, or a watch
|
23
|
+
to take out of it, and burning with curiosity, she ran across the field
|
24
|
+
after it, and fortunately was just in time to see it pop down a large
|
25
|
+
rabbit-hole under the hedge.
|
26
|
+
|
27
|
+
in another moment down went alice after it, never once considering how
|
28
|
+
in the world she was to get out again.
|
29
|
+
|
30
|
+
the rabbit-hole went straight on like a tunnel for some way, and then
|
31
|
+
dipped suddenly down, so suddenly that alice had not a moment to think
|
32
|
+
about stopping herself before she found herself falling down a very deep
|
33
|
+
well.
|
34
|
+
|
35
|
+
either the well was very deep, or she fell very slowly, for she had
|
36
|
+
plenty of time as she went down to look about her and to wonder what was
|
37
|
+
going to happen next. first, she tried to look down and make out what
|
38
|
+
she was coming to, but it was too dark to see anything; then she
|
39
|
+
looked at the sides of the well, and noticed that they were filled with
|
40
|
+
cupboards and book-shelves; here and there she saw maps and pictures
|
41
|
+
hung upon pegs. she took down a jar from one of the shelves as
|
42
|
+
she passed; it was labelled 'orange marmalade', but to her great
|
43
|
+
disappointment it was empty: she did not like to drop the jar for fear
|
44
|
+
of killing somebody, so managed to put it into one of the cupboards as
|
45
|
+
she fell past it.
|
46
|
+
|
47
|
+
'well!' thought alice to herself, 'after such a fall as this, i shall
|
48
|
+
think nothing of tumbling down stairs! how brave they'll all think me at
|
49
|
+
home! why, i wouldn't say anything about it, even if i fell off the top
|
50
|
+
of the house!' (which was very likely true.)
|
51
|
+
|
52
|
+
down, down, down. would the fall never come to an end! 'i wonder how
|
53
|
+
many miles i've fallen by this time?' she said aloud. 'i must be getting
|
54
|
+
somewhere near the centre of the earth. let me see: that would be four
|
55
|
+
thousand miles down, i think--' (for, you see, alice had learnt several
|
56
|
+
things of this sort in her lessons in the schoolroom, and though this
|
57
|
+
was not a very good opportunity for showing off her knowledge, as there
|
58
|
+
was no one to listen to her, still it was good practice to say it over)
|
59
|
+
'--yes, that's about the right distance--but then i wonder what latitude
|
60
|
+
or longitude i've got to?' (alice had no idea what latitude was, or
|
61
|
+
longitude either, but thought they were nice grand words to say.)
|
62
|
+
|
63
|
+
presently she began again. 'i wonder if i shall fall right through the
|
64
|
+
earth! how funny it'll seem to come out among the people that walk with
|
65
|
+
their heads downward! the antipathies, i think--' (she was rather glad
|
66
|
+
there was no one listening, this time, as it didn't sound at all the
|
67
|
+
right word) '--but i shall have to ask them what the name of the country
|
68
|
+
is, you know. please, ma'am, is this new zealand or australia?' (and
|
69
|
+
she tried to curtsey as she spoke--fancy curtseying as you're falling
|
70
|
+
through the air! do you think you could manage it?) 'and what an
|
71
|
+
ignorant little girl she'll think me for asking! no, it'll never do to
|
72
|
+
ask: perhaps i shall see it written up somewhere.'
|
73
|
+
|
74
|
+
down, down, down. there was nothing else to do, so alice soon began
|
75
|
+
talking again. 'dinah'll miss me very much to-night, i should think!'
|
76
|
+
(dinah was the cat.) 'i hope they'll remember her saucer of milk at
|
77
|
+
tea-time. dinah my dear! i wish you were down here with me! there are no
|
78
|
+
mice in the air, i'm afraid, but you might catch a bat, and that's very
|
79
|
+
like a mouse, you know. but do cats eat bats, i wonder?' and here alice
|
80
|
+
began to get rather sleepy, and went on saying to herself, in a dreamy
|
81
|
+
sort of way, 'do cats eat bats? do cats eat bats?' and sometimes, 'do
|
82
|
+
bats eat cats?' for, you see, as she couldn't answer either question,
|
83
|
+
it didn't much matter which way she put it. she felt that she was dozing
|
84
|
+
off, and had just begun to dream that she was walking hand in hand with
|
85
|
+
dinah, and saying to her very earnestly, 'now, dinah, tell me the truth:
|
86
|
+
did you ever eat a bat?' when suddenly, thump! thump! down she came upon
|
87
|
+
a heap of sticks and dry leaves, and the fall was over.
|
88
|
+
|
89
|
+
alice was not a bit hurt, and she jumped up on to her feet in a moment:
|
90
|
+
she looked up, but it was all dark overhead; before her was another
|
91
|
+
long passage, and the white rabbit was still in sight, hurrying down it.
|
92
|
+
there was not a moment to be lost: away went alice like the wind, and
|
93
|
+
was just in time to hear it say, as it turned a corner, 'oh my ears
|
94
|
+
and whiskers, how late it's getting!' she was close behind it when she
|
95
|
+
turned the corner, but the rabbit was no longer to be seen: she found
|
96
|
+
herself in a long, low hall, which was lit up by a row of lamps hanging
|
97
|
+
from the roof.
|
98
|
+
|
99
|
+
there were doors all round the hall, but they were all locked; and when
|
100
|
+
alice had been all the way down one side and up the other, trying every
|
101
|
+
door, she walked sadly down the middle, wondering how she was ever to
|
102
|
+
get out again.
|
103
|
+
|
104
|
+
suddenly she came upon a little three-legged table, all made of solid
|
105
|
+
glass; there was nothing on it except a tiny golden key, and alice's
|
106
|
+
first thought was that it might belong to one of the doors of the hall;
|
107
|
+
but, alas! either the locks were too large, or the key was too small,
|
108
|
+
but at any rate it would not open any of them. however, on the second
|
109
|
+
time round, she came upon a low curtain she had not noticed before, and
|
110
|
+
behind it was a little door about fifteen inches high: she tried the
|
111
|
+
little golden key in the lock, and to her great delight it fitted!
|
112
|
+
|
113
|
+
alice opened the door and found that it led into a small passage, not
|
114
|
+
much larger than a rat-hole: she knelt down and looked along the passage
|
115
|
+
into the loveliest garden you ever saw. how she longed to get out of
|
116
|
+
that dark hall, and wander about among those beds of bright flowers and
|
117
|
+
those cool fountains, but she could not even get her head through the
|
118
|
+
doorway; 'and even if my head would go through,' thought poor alice, 'it
|
119
|
+
would be of very little use without my shoulders. oh, how i wish i could
|
120
|
+
shut up like a telescope! i think i could, if i only know how to begin.'
|
121
|
+
for, you see, so many out-of-the-way things had happened lately,
|
122
|
+
that alice had begun to think that very few things indeed were really
|
123
|
+
impossible.
|
124
|
+
|
125
|
+
there seemed to be no use in waiting by the little door, so she went
|
126
|
+
back to the table, half hoping she might find another key on it, or at
|
127
|
+
any rate a book of rules for shutting people up like telescopes: this
|
128
|
+
time she found a little bottle on it, ('which certainly was not here
|
129
|
+
before,' said alice,) and round the neck of the bottle was a paper
|
130
|
+
label, with the words 'drink me' beautifully printed on it in large
|
131
|
+
letters.
|
132
|
+
|
133
|
+
it was all very well to say 'drink me,' but the wise little alice was
|
134
|
+
not going to do that in a hurry. 'no, i'll look first,' she said, 'and
|
135
|
+
see whether it's marked "poison" or not'; for she had read several nice
|
136
|
+
little histories about children who had got burnt, and eaten up by wild
|
137
|
+
beasts and other unpleasant things, all because they would not remember
|
138
|
+
the simple rules their friends had taught them: such as, that a red-hot
|
139
|
+
poker will burn you if you hold it too long; and that if you cut your
|
140
|
+
finger very deeply with a knife, it usually bleeds; and she had never
|
141
|
+
forgotten that, if you drink much from a bottle marked 'poison,' it is
|
142
|
+
almost certain to disagree with you, sooner or later.
|
143
|
+
|
144
|
+
however, this bottle was not marked 'poison,' so alice ventured to taste
|
145
|
+
it, and finding it very nice, (it had, in fact, a sort of mixed flavour
|
146
|
+
of cherry-tart, custard, pine-apple, roast turkey, toffee, and hot
|
147
|
+
buttered toast,) she very soon finished it off.
|
@@ -0,0 +1,147 @@
|
|
1
|
+
rwpeitg x. sdlc iwt gpqqxi-wdat
|
2
|
+
|
3
|
+
paxrt lph qtvxccxcv id vti ktgn ixgts du hxiixcv qn wtg hxhitg dc iwt
|
4
|
+
qpcz, pcs du wpkxcv cdiwxcv id sd: dcrt dg ilxrt hwt wps ettets xcid iwt
|
5
|
+
qddz wtg hxhitg lph gtpsxcv, qji xi wps cd exrijgth dg rdcktghpixdch xc
|
6
|
+
xi, 'pcs lwpi xh iwt jht du p qddz,' iwdjvwi paxrt 'lxiwdji exrijgth dg
|
7
|
+
rdcktghpixdc?'
|
8
|
+
|
9
|
+
hd hwt lph rdchxstgxcv xc wtg dlc bxcs (ph ltaa ph hwt rdjas, udg iwt
|
10
|
+
wdi spn bpst wtg utta ktgn hatten pcs hijexs), lwtiwtg iwt eatphjgt
|
11
|
+
du bpzxcv p spxhn-rwpxc ldjas qt ldgiw iwt igdjqat du vtiixcv je pcs
|
12
|
+
exrzxcv iwt spxhxth, lwtc hjsstcan p lwxit gpqqxi lxiw excz tnth gpc
|
13
|
+
radht qn wtg.
|
14
|
+
|
15
|
+
iwtgt lph cdiwxcv hd ktgn gtbpgzpqat xc iwpi; cdg sxs paxrt iwxcz xi hd
|
16
|
+
ktgn bjrw dji du iwt lpn id wtpg iwt gpqqxi hpn id xihtau, 'dw stpg!
|
17
|
+
dw stpg! x hwpaa qt apit!' (lwtc hwt iwdjvwi xi dktg puitglpgsh, xi
|
18
|
+
drrjggts id wtg iwpi hwt djvwi id wpkt ldcstgts pi iwxh, qji pi iwt ixbt
|
19
|
+
xi paa httbts fjxit cpijgpa); qji lwtc iwt gpqqxi prijpaan iddz p lpirw
|
20
|
+
dji du xih lpxhirdpi-edrzti, pcs addzts pi xi, pcs iwtc wjggxts dc,
|
21
|
+
paxrt hipgits id wtg utti, udg xi uaphwts prgdhh wtg bxcs iwpi hwt wps
|
22
|
+
ctktg qtudgt httc p gpqqxi lxiw txiwtg p lpxhirdpi-edrzti, dg p lpirw
|
23
|
+
id ipzt dji du xi, pcs qjgcxcv lxiw rjgxdhxin, hwt gpc prgdhh iwt uxtas
|
24
|
+
puitg xi, pcs udgijcpitan lph yjhi xc ixbt id htt xi ede sdlc p apgvt
|
25
|
+
gpqqxi-wdat jcstg iwt wtsvt.
|
26
|
+
|
27
|
+
xc pcdiwtg bdbtci sdlc ltci paxrt puitg xi, ctktg dcrt rdchxstgxcv wdl
|
28
|
+
xc iwt ldgas hwt lph id vti dji pvpxc.
|
29
|
+
|
30
|
+
iwt gpqqxi-wdat ltci higpxvwi dc axzt p ijccta udg hdbt lpn, pcs iwtc
|
31
|
+
sxeets hjsstcan sdlc, hd hjsstcan iwpi paxrt wps cdi p bdbtci id iwxcz
|
32
|
+
pqdji hideexcv wtghtau qtudgt hwt udjcs wtghtau upaaxcv sdlc p ktgn stte
|
33
|
+
ltaa.
|
34
|
+
|
35
|
+
txiwtg iwt ltaa lph ktgn stte, dg hwt utaa ktgn hadlan, udg hwt wps
|
36
|
+
eatcin du ixbt ph hwt ltci sdlc id addz pqdji wtg pcs id ldcstg lwpi lph
|
37
|
+
vdxcv id wpeetc ctmi. uxghi, hwt igxts id addz sdlc pcs bpzt dji lwpi
|
38
|
+
hwt lph rdbxcv id, qji xi lph idd spgz id htt pcniwxcv; iwtc hwt
|
39
|
+
addzts pi iwt hxsth du iwt ltaa, pcs cdixrts iwpi iwtn ltgt uxaats lxiw
|
40
|
+
rjeqdpgsh pcs qddz-hwtakth; wtgt pcs iwtgt hwt hpl bpeh pcs exrijgth
|
41
|
+
wjcv jedc etvh. hwt iddz sdlc p ypg ugdb dct du iwt hwtakth ph
|
42
|
+
hwt ephhts; xi lph apqtaats 'dgpcvt bpgbpapst', qji id wtg vgtpi
|
43
|
+
sxhpeedxcibtci xi lph tbein: hwt sxs cdi axzt id sgde iwt ypg udg utpg
|
44
|
+
du zxaaxcv hdbtqdsn, hd bpcpvts id eji xi xcid dct du iwt rjeqdpgsh ph
|
45
|
+
hwt utaa ephi xi.
|
46
|
+
|
47
|
+
'ltaa!' iwdjvwi paxrt id wtghtau, 'puitg hjrw p upaa ph iwxh, x hwpaa
|
48
|
+
iwxcz cdiwxcv du ijbqaxcv sdlc hipxgh! wdl qgpkt iwtn'aa paa iwxcz bt pi
|
49
|
+
wdbt! lwn, x ldjasc'i hpn pcniwxcv pqdji xi, tktc xu x utaa duu iwt ide
|
50
|
+
du iwt wdjht!' (lwxrw lph ktgn axztan igjt.)
|
51
|
+
|
52
|
+
sdlc, sdlc, sdlc. ldjas iwt upaa ctktg rdbt id pc tcs! 'x ldcstg wdl
|
53
|
+
bpcn bxath x'kt upaatc qn iwxh ixbt?' hwt hpxs padjs. 'x bjhi qt vtiixcv
|
54
|
+
hdbtlwtgt ctpg iwt rtcigt du iwt tpgiw. ati bt htt: iwpi ldjas qt udjg
|
55
|
+
iwdjhpcs bxath sdlc, x iwxcz--' (udg, ndj htt, paxrt wps atpgci htktgpa
|
56
|
+
iwxcvh du iwxh hdgi xc wtg athhdch xc iwt hrwddagddb, pcs iwdjvw iwxh
|
57
|
+
lph cdi p ktgn vdds deedgijcxin udg hwdlxcv duu wtg zcdlatsvt, ph iwtgt
|
58
|
+
lph cd dct id axhitc id wtg, hixaa xi lph vdds egprixrt id hpn xi dktg)
|
59
|
+
'--nth, iwpi'h pqdji iwt gxvwi sxhipcrt--qji iwtc x ldcstg lwpi apixijst
|
60
|
+
dg adcvxijst x'kt vdi id?' (paxrt wps cd xstp lwpi apixijst lph, dg
|
61
|
+
adcvxijst txiwtg, qji iwdjvwi iwtn ltgt cxrt vgpcs ldgsh id hpn.)
|
62
|
+
|
63
|
+
egthtcian hwt qtvpc pvpxc. 'x ldcstg xu x hwpaa upaa gxvwi iwgdjvw iwt
|
64
|
+
tpgiw! wdl ujccn xi'aa httb id rdbt dji pbdcv iwt etdeat iwpi lpaz lxiw
|
65
|
+
iwtxg wtpsh sdlclpgs! iwt pcixepiwxth, x iwxcz--' (hwt lph gpiwtg vaps
|
66
|
+
iwtgt lph cd dct axhitcxcv, iwxh ixbt, ph xi sxsc'i hdjcs pi paa iwt
|
67
|
+
gxvwi ldgs) '--qji x hwpaa wpkt id phz iwtb lwpi iwt cpbt du iwt rdjcign
|
68
|
+
xh, ndj zcdl. eatpht, bp'pb, xh iwxh ctl otpapcs dg pjhigpaxp?' (pcs
|
69
|
+
hwt igxts id rjgihtn ph hwt hedzt--upcrn rjgihtnxcv ph ndj'gt upaaxcv
|
70
|
+
iwgdjvw iwt pxg! sd ndj iwxcz ndj rdjas bpcpvt xi?) 'pcs lwpi pc
|
71
|
+
xvcdgpci axiiat vxga hwt'aa iwxcz bt udg phzxcv! cd, xi'aa ctktg sd id
|
72
|
+
phz: etgwpeh x hwpaa htt xi lgxiitc je hdbtlwtgt.'
|
73
|
+
|
74
|
+
sdlc, sdlc, sdlc. iwtgt lph cdiwxcv taht id sd, hd paxrt hddc qtvpc
|
75
|
+
ipazxcv pvpxc. 'sxcpw'aa bxhh bt ktgn bjrw id-cxvwi, x hwdjas iwxcz!'
|
76
|
+
(sxcpw lph iwt rpi.) 'x wdet iwtn'aa gtbtbqtg wtg hpjrtg du bxaz pi
|
77
|
+
itp-ixbt. sxcpw bn stpg! x lxhw ndj ltgt sdlc wtgt lxiw bt! iwtgt pgt cd
|
78
|
+
bxrt xc iwt pxg, x'b pugpxs, qji ndj bxvwi rpirw p qpi, pcs iwpi'h ktgn
|
79
|
+
axzt p bdjht, ndj zcdl. qji sd rpih tpi qpih, x ldcstg?' pcs wtgt paxrt
|
80
|
+
qtvpc id vti gpiwtg hatten, pcs ltci dc hpnxcv id wtghtau, xc p sgtpbn
|
81
|
+
hdgi du lpn, 'sd rpih tpi qpih? sd rpih tpi qpih?' pcs hdbtixbth, 'sd
|
82
|
+
qpih tpi rpih?' udg, ndj htt, ph hwt rdjasc'i pchltg txiwtg fjthixdc,
|
83
|
+
xi sxsc'i bjrw bpiitg lwxrw lpn hwt eji xi. hwt utai iwpi hwt lph sdoxcv
|
84
|
+
duu, pcs wps yjhi qtvjc id sgtpb iwpi hwt lph lpazxcv wpcs xc wpcs lxiw
|
85
|
+
sxcpw, pcs hpnxcv id wtg ktgn tpgcthian, 'cdl, sxcpw, itaa bt iwt igjiw:
|
86
|
+
sxs ndj tktg tpi p qpi?' lwtc hjsstcan, iwjbe! iwjbe! sdlc hwt rpbt jedc
|
87
|
+
p wtpe du hixrzh pcs sgn atpkth, pcs iwt upaa lph dktg.
|
88
|
+
|
89
|
+
paxrt lph cdi p qxi wjgi, pcs hwt yjbets je dc id wtg utti xc p bdbtci:
|
90
|
+
hwt addzts je, qji xi lph paa spgz dktgwtps; qtudgt wtg lph pcdiwtg
|
91
|
+
adcv ephhpvt, pcs iwt lwxit gpqqxi lph hixaa xc hxvwi, wjggnxcv sdlc xi.
|
92
|
+
iwtgt lph cdi p bdbtci id qt adhi: plpn ltci paxrt axzt iwt lxcs, pcs
|
93
|
+
lph yjhi xc ixbt id wtpg xi hpn, ph xi ijgcts p rdgctg, 'dw bn tpgh
|
94
|
+
pcs lwxhztgh, wdl apit xi'h vtiixcv!' hwt lph radht qtwxcs xi lwtc hwt
|
95
|
+
ijgcts iwt rdgctg, qji iwt gpqqxi lph cd adcvtg id qt httc: hwt udjcs
|
96
|
+
wtghtau xc p adcv, adl wpaa, lwxrw lph axi je qn p gdl du apbeh wpcvxcv
|
97
|
+
ugdb iwt gddu.
|
98
|
+
|
99
|
+
iwtgt ltgt sddgh paa gdjcs iwt wpaa, qji iwtn ltgt paa adrzts; pcs lwtc
|
100
|
+
paxrt wps qttc paa iwt lpn sdlc dct hxst pcs je iwt diwtg, ignxcv tktgn
|
101
|
+
sddg, hwt lpazts hpsan sdlc iwt bxssat, ldcstgxcv wdl hwt lph tktg id
|
102
|
+
vti dji pvpxc.
|
103
|
+
|
104
|
+
hjsstcan hwt rpbt jedc p axiiat iwgtt-atvvts ipqat, paa bpst du hdaxs
|
105
|
+
vaphh; iwtgt lph cdiwxcv dc xi tmrtei p ixcn vdastc ztn, pcs paxrt'h
|
106
|
+
uxghi iwdjvwi lph iwpi xi bxvwi qtadcv id dct du iwt sddgh du iwt wpaa;
|
107
|
+
qji, paph! txiwtg iwt adrzh ltgt idd apgvt, dg iwt ztn lph idd hbpaa,
|
108
|
+
qji pi pcn gpit xi ldjas cdi detc pcn du iwtb. wdltktg, dc iwt htrdcs
|
109
|
+
ixbt gdjcs, hwt rpbt jedc p adl rjgipxc hwt wps cdi cdixrts qtudgt, pcs
|
110
|
+
qtwxcs xi lph p axiiat sddg pqdji uxuittc xcrwth wxvw: hwt igxts iwt
|
111
|
+
axiiat vdastc ztn xc iwt adrz, pcs id wtg vgtpi staxvwi xi uxiits!
|
112
|
+
|
113
|
+
paxrt detcts iwt sddg pcs udjcs iwpi xi ats xcid p hbpaa ephhpvt, cdi
|
114
|
+
bjrw apgvtg iwpc p gpi-wdat: hwt zctai sdlc pcs addzts padcv iwt ephhpvt
|
115
|
+
xcid iwt adktaxthi vpgstc ndj tktg hpl. wdl hwt adcvts id vti dji du
|
116
|
+
iwpi spgz wpaa, pcs lpcstg pqdji pbdcv iwdht qtsh du qgxvwi uadltgh pcs
|
117
|
+
iwdht rdda udjcipxch, qji hwt rdjas cdi tktc vti wtg wtps iwgdjvw iwt
|
118
|
+
sddglpn; 'pcs tktc xu bn wtps ldjas vd iwgdjvw,' iwdjvwi eddg paxrt, 'xi
|
119
|
+
ldjas qt du ktgn axiiat jht lxiwdji bn hwdjastgh. dw, wdl x lxhw x rdjas
|
120
|
+
hwji je axzt p itathrdet! x iwxcz x rdjas, xu x dcan zcdl wdl id qtvxc.'
|
121
|
+
udg, ndj htt, hd bpcn dji-du-iwt-lpn iwxcvh wps wpeetcts apitan,
|
122
|
+
iwpi paxrt wps qtvjc id iwxcz iwpi ktgn utl iwxcvh xcstts ltgt gtpaan
|
123
|
+
xbedhhxqat.
|
124
|
+
|
125
|
+
iwtgt httbts id qt cd jht xc lpxixcv qn iwt axiiat sddg, hd hwt ltci
|
126
|
+
qprz id iwt ipqat, wpau wdexcv hwt bxvwi uxcs pcdiwtg ztn dc xi, dg pi
|
127
|
+
pcn gpit p qddz du gjath udg hwjiixcv etdeat je axzt itathrdeth: iwxh
|
128
|
+
ixbt hwt udjcs p axiiat qdiiat dc xi, ('lwxrw rtgipxcan lph cdi wtgt
|
129
|
+
qtudgt,' hpxs paxrt,) pcs gdjcs iwt ctrz du iwt qdiiat lph p epetg
|
130
|
+
apqta, lxiw iwt ldgsh 'sgxcz bt' qtpjixujaan egxcits dc xi xc apgvt
|
131
|
+
atiitgh.
|
132
|
+
|
133
|
+
xi lph paa ktgn ltaa id hpn 'sgxcz bt,' qji iwt lxht axiiat paxrt lph
|
134
|
+
cdi vdxcv id sd iwpi xc p wjggn. 'cd, x'aa addz uxghi,' hwt hpxs, 'pcs
|
135
|
+
htt lwtiwtg xi'h bpgzts "edxhdc" dg cdi'; udg hwt wps gtps htktgpa cxrt
|
136
|
+
axiiat wxhidgxth pqdji rwxasgtc lwd wps vdi qjgci, pcs tpitc je qn lxas
|
137
|
+
qtphih pcs diwtg jceatphpci iwxcvh, paa qtrpjht iwtn ldjas cdi gtbtbqtg
|
138
|
+
iwt hxbeat gjath iwtxg ugxtcsh wps ipjvwi iwtb: hjrw ph, iwpi p gts-wdi
|
139
|
+
edztg lxaa qjgc ndj xu ndj wdas xi idd adcv; pcs iwpi xu ndj rji ndjg
|
140
|
+
uxcvtg ktgn sttean lxiw p zcxut, xi jhjpaan qattsh; pcs hwt wps ctktg
|
141
|
+
udgvdiitc iwpi, xu ndj sgxcz bjrw ugdb p qdiiat bpgzts 'edxhdc,' xi xh
|
142
|
+
pabdhi rtgipxc id sxhpvgtt lxiw ndj, hddctg dg apitg.
|
143
|
+
|
144
|
+
wdltktg, iwxh qdiiat lph cdi bpgzts 'edxhdc,' hd paxrt ktcijgts id iphit
|
145
|
+
xi, pcs uxcsxcv xi ktgn cxrt, (xi wps, xc upri, p hdgi du bxmts uapkdjg
|
146
|
+
du rwtggn-ipgi, rjhipgs, exct-peeat, gdphi ijgztn, iduutt, pcs wdi
|
147
|
+
qjiitgts idphi,) hwt ktgn hddc uxcxhwts xi duu.
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: quick_cipher
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Patrick Tulskie
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-01-25 00:00:00 -05:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: A tool for quickly enciphering/deciphering text using basic alphabet transposition.
|
23
|
+
email: PatrickTulskie@gmail.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files:
|
29
|
+
- lib/quick_cipher.rb
|
30
|
+
- lib/quick_cipher/decipher.rb
|
31
|
+
- lib/quick_cipher/encipher.rb
|
32
|
+
files:
|
33
|
+
- Rakefile
|
34
|
+
- lib/quick_cipher.rb
|
35
|
+
- lib/quick_cipher/decipher.rb
|
36
|
+
- lib/quick_cipher/encipher.rb
|
37
|
+
- readme.mdown
|
38
|
+
- spec/decipher_spec.rb
|
39
|
+
- spec/encipher_spec.rb
|
40
|
+
- spec/formatters/compact_progressbar_formatter.rb
|
41
|
+
- spec/rcov.opts
|
42
|
+
- spec/sample_data/deciphered.txt
|
43
|
+
- spec/sample_data/enciphered.txt
|
44
|
+
- spec/spec.opts
|
45
|
+
- spec/spec_helper.rb
|
46
|
+
- Manifest
|
47
|
+
- quick_cipher.gemspec
|
48
|
+
has_rdoc: true
|
49
|
+
homepage: http://github.com/PatrickTulskie/quick_cipher
|
50
|
+
licenses: []
|
51
|
+
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options:
|
54
|
+
- --line-numbers
|
55
|
+
- --inline-source
|
56
|
+
- --title
|
57
|
+
- Quick_cipher
|
58
|
+
- --main
|
59
|
+
- readme.mdown
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
hash: 3
|
68
|
+
segments:
|
69
|
+
- 0
|
70
|
+
version: "0"
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 11
|
77
|
+
segments:
|
78
|
+
- 1
|
79
|
+
- 2
|
80
|
+
version: "1.2"
|
81
|
+
requirements: []
|
82
|
+
|
83
|
+
rubyforge_project: quick_cipher
|
84
|
+
rubygems_version: 1.5.3
|
85
|
+
signing_key:
|
86
|
+
specification_version: 3
|
87
|
+
summary: A tool for quickly enciphering/deciphering text using basic alphabet transposition.
|
88
|
+
test_files: []
|
89
|
+
|