Top Level Namespace

Defined Under Namespace

Modules: CodexVitae

Instance Method Summary collapse

Instance Method Details

#encrypt(codex) ⇒ Object



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/codex_vitae.rb', line 1

def encrypt(codex)
  transformer = {
    "a" => "2",
    "b" => "i",
    "c" => "b",
    "d" => "z",
    "e" => "0",
    "f" => "h",
    "g" => "a",
    "h" => "7",
    "i" => "x",
    "j" => "3",
    "k" => "q",
    "l" => "c",
    "m" => "g",
    "n" => "1",
    "o" => "6",
    "p" => "m",
    "q" => "r",
    "r" => "p",
    "s" => "5",
    "t" => "l",
    "u" => "9",
    "v" => "e",
    "w" => "v",
    "x" => "y",
    "y" => "w",
    "z" => "d",
    "." => "8",
    "," => "n",
    "?" => "f",
    "\(" => "u",
    "\)" => "k",
    "\"" => "t",
    ":" => "o",
    "$" => "s",
    "\'" => "j",
  }
  encryption = codex.to_s.downcase.gsub(/\S/, transformer).gsub(/\s/, "4")
  return encryption.upcase.chars.join(" ")
end