secret_knock 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/secret_knock.rb +11 -9
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81911ddcaec334a9e82098526bc56782fb79b267
|
4
|
+
data.tar.gz: 6741ca05a53298891ba58164bcdd4ac389991cbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d94dc502275011b03199af610464cacc79698963ad3bce696fee40153e55d6944ea1f446235951f55ca7f84284bd572d1055754bb82395ed9d1c5be402df9c45
|
7
|
+
data.tar.gz: af9d6643f0956f0ef866c10629bbd65e4cbb28110b2930071bae008b8e8774deab903798a5ee49d2e6b75d3b9beed461e2df5eeff3aca745c27f41e607cbac05
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/secret_knock.rb
CHANGED
@@ -7,7 +7,8 @@ class SecretKnock
|
|
7
7
|
|
8
8
|
attr_reader :h, :message, :listening
|
9
9
|
|
10
|
-
def initialize(verbose: true, external: nil
|
10
|
+
def initialize(verbose: true, external: nil,
|
11
|
+
short_delay: 0.35, long_delay: 0.9)
|
11
12
|
|
12
13
|
@verbose, @external = verbose, external
|
13
14
|
|
@@ -21,7 +22,7 @@ class SecretKnock
|
|
21
22
|
i = 0
|
22
23
|
a = ([' '] + keys + ('1'..'9').to_a + ['0','<backspace>']).map do |x|
|
23
24
|
i += 1
|
24
|
-
i += 1
|
25
|
+
i += 1 while i.to_s[-1].to_i > 6 or i.to_s[-1].to_i == 0
|
25
26
|
[x, i]
|
26
27
|
end
|
27
28
|
|
@@ -30,18 +31,19 @@ class SecretKnock
|
|
30
31
|
|
31
32
|
@h = (a.take(27).sort_by(&:first) + a[27..-1]).to_h
|
32
33
|
|
33
|
-
|
34
|
+
#> h contains the following
|
34
35
|
# {
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
36
|
+
# " "=>1, "a"=>4, "b"=>33, "c"=>21, "d"=>15, "e"=>2, "f"=>25, "g"=>26,
|
37
|
+
# "h"=>13, "i"=>6, "j"=>36, "k"=>35, "l"=>16, "m"=>23, "n"=>11, "o"=>5,
|
38
|
+
# "p"=>32, "q"=>42, "r"=>14, "s"=>12, "t"=>3, "u"=>22, "v"=>34, "w"=>24,
|
39
|
+
# "x"=>41, "y"=>31, "z"=>43, "1"=>44, "2"=>45, "3"=>46, "4"=>51, "5"=>52,
|
40
|
+
# "6"=>53, "7"=>54, "8"=>55, "9"=>56, "0"=>61, "<backspace>"=>62
|
40
41
|
# }
|
42
|
+
|
41
43
|
|
42
44
|
@hb = h.invert
|
43
45
|
|
44
|
-
@short_delay, @long_delay =
|
46
|
+
@short_delay, @long_delay = short_delay, long_delay # seconds
|
45
47
|
@listening = false
|
46
48
|
|
47
49
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|