passlock 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/passlock.rb +6 -6
- data/lib/passlock/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f850563e737ffa8e9ec1ee225757cbd75eb5d528
|
4
|
+
data.tar.gz: ad812a50d9562b000022f993a22462b76f1c92e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 381e9e683da4a2d0071cf1c597da37e21a835c45c2d5489cb523224e83f545c2d2dd56898f5cc9afbfaf2a440e20b2bc6b124c132326cca65a8b471750964a6a
|
7
|
+
data.tar.gz: d1c8db6a94649b71639ade81070afd4063e0013710b176b875388605010b5968ce04ff5a379826179566976067acfbd7678a746d1180176e3635359399a08a62
|
data/lib/passlock.rb
CHANGED
@@ -12,7 +12,7 @@ module PassLock
|
|
12
12
|
'number' => '1234567890',
|
13
13
|
'upletter' => 'qwertyuiopasdfghjklzxcvbnm'.upcase,
|
14
14
|
'downletter' => 'qwertyuiopasdfghjklzxcvbnm',
|
15
|
-
'symbols' => %q
|
15
|
+
'symbols' => %q(`~!@#$%^&*()_+-=[]{}\|;':",.<>/?)
|
16
16
|
}
|
17
17
|
|
18
18
|
# A randomly generated passord.
|
@@ -20,12 +20,12 @@ module PassLock
|
|
20
20
|
# @param length [Integer] How long the password will be
|
21
21
|
# @return [String] Returns the Base64-encoded version of the password.
|
22
22
|
def self.cpass(options, length)
|
23
|
-
options = options != Array || options.empty? ? options : %w
|
24
|
-
length = length.is_a(Integer) && length > 0 ? length : 10
|
23
|
+
options = options != Array || options.empty? ? options : %w(number upletter downletter symbol)
|
24
|
+
length = length.is_a?(Integer) && length > 0 ? length : 10
|
25
25
|
chars = []
|
26
|
-
result =
|
26
|
+
result = ''
|
27
27
|
options.each do |flag|
|
28
|
-
chars.concat(@opts[flag].scan(/./)) unless
|
28
|
+
chars.concat(@opts[flag].scan(/./)) unless @opts[flag].nil?
|
29
29
|
end
|
30
30
|
length.to_i.times do
|
31
31
|
result += chars.sample
|
@@ -105,8 +105,8 @@ module PassLock
|
|
105
105
|
pass
|
106
106
|
end
|
107
107
|
|
108
|
+
# Decode module
|
108
109
|
class Decode
|
109
|
-
|
110
110
|
# Decodes password in Base64.
|
111
111
|
# @param base [String] The Base64-encoded of the original password
|
112
112
|
# @return [String] Returns the decoded password
|
data/lib/passlock/version.rb
CHANGED