leetpassword 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data/lib/leetpassword.rb +93 -11
- data.tar.gz.sig +2 -2
- metadata +32 -29
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 525ed07cdf7cb955fea1468d151e39b33493e8382e5243702f8601606f897206
|
4
|
+
data.tar.gz: 77ce5322708ffb6a0295988e3049d619a855ab09434d83cd6dc5bef73ce16f43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e670eaa8346bc1b380a0644f4d4797c945ee51cbf5a79c7667943581c4d5691f0f88b0ad50c61131181a3ec7f9ab14f78fcfb61e01592b51d598dab09520c650
|
7
|
+
data.tar.gz: 318377588112f117415b5cbbc56c368afd4e0fb16c29179dc54ea2d38536efa1a6299c820312ac2f81ed550c51fdf144b5a167772816f67f0a975d65920f57dd
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/leetpassword.rb
CHANGED
@@ -6,42 +6,124 @@ require 'random_word'
|
|
6
6
|
|
7
7
|
class LeetPassword
|
8
8
|
|
9
|
-
|
9
|
+
# note: nowadays it's typical for passwords to be required to
|
10
|
+
# contain at least 1 symbol, 2 uppercase characters and 2 numerals
|
11
|
+
#
|
12
|
+
def self.generate(max_len=nil, subs: {i: '1', o: '0', e: '3'},
|
13
|
+
symlist: ['@'], upcase: 2, symchar: 1, debug: false,
|
14
|
+
verbose: true)
|
15
|
+
|
16
|
+
max_len += symchar if max_len
|
10
17
|
|
11
18
|
if max_len and max_len <= 6 then
|
12
19
|
raise "max length must be greater than 6 characters"
|
13
20
|
end
|
14
21
|
|
15
|
-
|
22
|
+
rawnoun = RandomWord.nouns.next
|
23
|
+
hint1 = rawnoun.clone
|
24
|
+
noun = rawnoun.gsub(/_/,'')
|
16
25
|
if max_len then
|
17
26
|
until noun.length >= 6 and noun.length <= max_len
|
18
|
-
|
27
|
+
rawnoun = RandomWord.nouns.next
|
28
|
+
hint1 = rawnoun.clone
|
29
|
+
noun = rawnoun.gsub(/_/,'')
|
19
30
|
end
|
20
31
|
end
|
21
32
|
|
33
|
+
|
22
34
|
subs.each{|k,v| noun.gsub!(k.to_s,v)}
|
23
|
-
return noun if noun.length > 7
|
24
35
|
|
25
|
-
|
36
|
+
if noun.length > 7 then
|
37
|
+
|
38
|
+
n = upcase / 2
|
39
|
+
r = upcase - n
|
40
|
+
noun.sub!(/[a-z]{#{n}}/) {|x| x.upcase}
|
41
|
+
noun.sub!(/[a-z]{#{r}}/) {|x| x.upcase}
|
42
|
+
|
43
|
+
noun += symlist.sample
|
44
|
+
puts 'returning a noun' if debug
|
45
|
+
puts 'hint: ' + hint1 if verbose
|
46
|
+
return [noun, :noun, hint1]
|
47
|
+
end
|
48
|
+
|
49
|
+
rawadj = RandomWord.adjs.next
|
50
|
+
hint2 = rawadj.clone
|
51
|
+
adj = rawadj.gsub(/_/,'')
|
52
|
+
|
26
53
|
if max_len then
|
27
54
|
until adj.length >= 6 and adj.length <= max_len
|
28
|
-
|
55
|
+
rawadj = RandomWord.adjs.next
|
56
|
+
hint2 = rawadj.clone
|
57
|
+
adj = rawadj.gsub(/_/,'')
|
29
58
|
end
|
30
59
|
end
|
31
60
|
|
61
|
+
|
32
62
|
subs.each{|k,v| adj.gsub!(k.to_s,v)}
|
33
63
|
|
34
|
-
|
64
|
+
if adj.length > 7 then
|
65
|
+
n = upcase / 2
|
66
|
+
r = upcase - n
|
67
|
+
adj.sub!(/[a-z]{#{n}}/) {|x| x.upcase}
|
68
|
+
adj.sub!(/[a-z]{#{r}}/) {|x| x.upcase}
|
69
|
+
adj += symlist.sample
|
70
|
+
puts 'returning an adjective' if debug
|
71
|
+
puts 'hint: ' + hint2 if verbose
|
72
|
+
return [adj, :adj, hint2]
|
73
|
+
end
|
74
|
+
|
75
|
+
hint = hint1 + ' ' + hint2
|
35
76
|
|
36
77
|
if max_len then
|
37
|
-
|
38
|
-
|
78
|
+
|
79
|
+
words = [noun, adj]
|
80
|
+
|
81
|
+
n = upcase / 2
|
82
|
+
r = upcase - n
|
83
|
+
words[0].sub!(/.{#{n}}/) {|x| x.upcase}
|
84
|
+
words[-1].sub!(/.{#{r}}/) {|x| x.upcase}
|
85
|
+
words.insert 1, symlist.sample(symchar)
|
86
|
+
|
87
|
+
if (words.join).length <= max_len then
|
88
|
+
puts 'returning a maxlen word' if debug
|
89
|
+
puts 'hint: ' + hint if verbose
|
90
|
+
return [words.join, :maxlen, hint]
|
39
91
|
else
|
40
|
-
LeetPassword.generate(max_len,
|
92
|
+
LeetPassword.generate(max_len, verbose: verbose)
|
41
93
|
end
|
94
|
+
|
42
95
|
else
|
43
|
-
|
96
|
+
|
97
|
+
words = [noun, adj]
|
98
|
+
n = upcase / 2
|
99
|
+
r = upcase - n
|
100
|
+
|
101
|
+
words[0].sub!(/.{#{n}}/) {|x| x.upcase}
|
102
|
+
words[-1].sub!(/.{#{r}}/) {|x| x.upcase}
|
103
|
+
words.insert 1, symlist.sample(symchar)
|
104
|
+
puts 'words: ' + words.inspect if debug
|
105
|
+
puts 'returning a variable length' if debug
|
106
|
+
puts 'hint: ' + hint if verbose
|
107
|
+
return [words.join, :varlen, hint]
|
108
|
+
|
44
109
|
end
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
# This method makes it easier to remember the password since it consists of
|
114
|
+
# the following:
|
115
|
+
#
|
116
|
+
# * 2 words
|
117
|
+
# * each word is capitalized
|
118
|
+
# * the letters i, e, o are replaced with the numbers 1, 3, and
|
119
|
+
# 0 respectively
|
120
|
+
# * the words are separated by the @ symbol
|
121
|
+
# * a password never longer than 12 characters
|
122
|
+
#
|
123
|
+
def self.easygen()
|
124
|
+
pwd, type, hint = self.generate(12, verbose: false) until type == :maxlen
|
125
|
+
puts 'hint: ' + hint
|
126
|
+
return pwd
|
45
127
|
end
|
46
128
|
end
|
47
129
|
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
V^DCH���h�73�� y���ߦ`������8+!�O�`����~�?=�"�8i�#Z�0�K6@�SKa#=��=�V�6�7A���-UUq]��'J��T��|���@��Qւ@d��a17E���M�A�����f���KK��x�q�˙���^�P5�����iZW�:B���{qB��S�+#�`@�����
|
2
|
+
�ً�r��@m�>���Y2A��J.k�SJ�לs���[t��P#�c���f̃�o���Ƣ*P�Θ^C[�Жޢ�8��: ����g���
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leetpassword
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,28 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjIwNTI2MDcyNjI5WhcN
|
15
|
+
MjMwNTI2MDcyNjI5WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDjaDKP
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vbIU5uem017NSHD00bmH1xO4+Dxhh
|
32
|
+
ve3J+5FvPjgE54S29bbfgvMJRPNPpRf1kAxpHNmm4d+5QJRoIkFgwqr83jFW1w+l
|
33
|
+
5wuteMtb63Rh60vdtkMRexdlSWF0Tbns/otn0oLNTGDEjptmskS9Tt9asV+vy+38
|
34
|
+
gB5hvm0ZVOhWTupZAzI90V0KfVnVqfeBrXD+e+2LhQZPur7DKW6hJ7atyXoKnPGQ
|
35
|
+
wsJoMv/2Pxome92q2iZQ0ZEEV4DYM6tpetiC3sLMT70W5dBAck6YkUBfDlbRlrU1
|
36
|
+
a48r2r3b5G9dmbtyJVaowaxo
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
38
|
+
date: 2022-05-26 00:00:00.000000000 Z
|
35
39
|
dependencies:
|
36
40
|
- !ruby/object:Gem::Dependency
|
37
41
|
name: random_word
|
@@ -39,22 +43,22 @@ dependencies:
|
|
39
43
|
requirements:
|
40
44
|
- - "~>"
|
41
45
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
46
|
+
version: '2.1'
|
43
47
|
- - ">="
|
44
48
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
49
|
+
version: 2.1.1
|
46
50
|
type: :runtime
|
47
51
|
prerelease: false
|
48
52
|
version_requirements: !ruby/object:Gem::Requirement
|
49
53
|
requirements:
|
50
54
|
- - "~>"
|
51
55
|
- !ruby/object:Gem::Version
|
52
|
-
version: '
|
56
|
+
version: '2.1'
|
53
57
|
- - ">="
|
54
58
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
59
|
+
version: 2.1.1
|
56
60
|
description:
|
57
|
-
email:
|
61
|
+
email: digital.robertson@gmail.com
|
58
62
|
executables: []
|
59
63
|
extensions: []
|
60
64
|
extra_rdoc_files: []
|
@@ -79,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
83
|
- !ruby/object:Gem::Version
|
80
84
|
version: '0'
|
81
85
|
requirements: []
|
82
|
-
|
83
|
-
rubygems_version: 2.6.13
|
86
|
+
rubygems_version: 3.2.22
|
84
87
|
signing_key:
|
85
88
|
specification_version: 4
|
86
89
|
summary: leetpassword creates a password with 1 or 2 random leet words.
|
metadata.gz.sig
CHANGED
Binary file
|