caesars_cypher 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/caesars_cypher.rb +32 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e6b3160d06ee1a4b22ff0cf9b9f109c76c305fcf
|
4
|
+
data.tar.gz: b559fe0f78d9f3006583534347ebfed091c3eb2f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6232f3b223b71ec5cce6b149c40fed3e7765af68294ffc938e2180f4db154c5656248359b41b4e88c226f4d85248bde1287012d40a5dc94a3f2cc1a68a92fd8e
|
7
|
+
data.tar.gz: 96ecae8a47184ec27eaebda94f8573c933d20c58849b98849c69e61c1bc5fcd2f62c51efa707c3eef8ff4511683625e19ce81f18ab7418eaf5c1d3cbb4d6f397
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class CaesarsCypher
|
2
|
+
|
3
|
+
def self.cipher
|
4
|
+
{'a' => 'n', 'b' => 'o', 'c' => 'p', 'd' => 'q',
|
5
|
+
'e' => 'r', 'f' => 's', 'g' => 't', 'h' => 'u',
|
6
|
+
'i' => 'v', 'j' => 'w', 'k' => 'x', 'l' => 'y',
|
7
|
+
'm' => 'z', 'n' => 'a', 'o' => 'b', 'p' => 'c',
|
8
|
+
'q' => 'd', 'r' => 'e', 's' => 'f', 't' => 'g',
|
9
|
+
'u' => 'h', 'v' => 'i', 'w' => 'j', 'x' => 'k',
|
10
|
+
'y' => 'l', 'z' => 'm'}
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.words_downcase(letter)
|
14
|
+
downcase_letter = letter.downcase
|
15
|
+
self.cipher[downcase_letter]
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.encrypt(letters)
|
19
|
+
letter_split = letters.split('')
|
20
|
+
result = []
|
21
|
+
|
22
|
+
letter_split.each do |word|
|
23
|
+
encrypted = self.words_downcase(word)
|
24
|
+
result.push(encrypted)
|
25
|
+
end
|
26
|
+
result.join('')
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.decrypt(letters)
|
30
|
+
self.encrypt(letters)
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: caesars_cypher
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hayri Cicek
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-26 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A little gem which encrypts and decrypts Caesar's Cypher messages
|
14
|
+
email: hayri@hoshilab.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/caesars_cypher.rb
|
20
|
+
homepage: http://github.com/cicekhayri/caesars_cypher_gem
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.2.2
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Caesars Cypher
|
44
|
+
test_files: []
|
45
|
+
has_rdoc:
|