leetpassword 0.1.1 → 1.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
- checksums.yaml.gz.sig +0 -0
- data/lib/leetpassword.rb +94 -12
- data.tar.gz.sig +2 -2
- metadata +66 -61
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 525ed07cdf7cb955fea1468d151e39b33493e8382e5243702f8601606f897206
|
4
|
+
data.tar.gz: 77ce5322708ffb6a0295988e3049d619a855ab09434d83cd6dc5bef73ce16f43
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e670eaa8346bc1b380a0644f4d4797c945ee51cbf5a79c7667943581c4d5691f0f88b0ad50c61131181a3ec7f9ab14f78fcfb61e01592b51d598dab09520c650
|
7
|
+
data.tar.gz: 318377588112f117415b5cbbc56c368afd4e0fb16c29179dc54ea2d38536efa1a6299c820312ac2f81ed550c51fdf144b5a167772816f67f0a975d65920f57dd
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data/lib/leetpassword.rb
CHANGED
@@ -2,46 +2,128 @@
|
|
2
2
|
|
3
3
|
# file: leetpassword.rb
|
4
4
|
|
5
|
-
require '
|
5
|
+
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,85 +1,90 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: leetpassword
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.1.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
|
-
authors:
|
6
|
+
authors:
|
8
7
|
- James Robertson
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
|
-
cert_chain:
|
10
|
+
cert_chain:
|
12
11
|
- |
|
13
12
|
-----BEGIN CERTIFICATE-----
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjIwNTI2MDcyNjI5WhcN
|
15
|
+
MjMwNTI2MDcyNjI5WjAsMSowKAYDVQQDDCFnZ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jAgqG2C0+5yUCQXzej0wIWU0n3L1/6e5V8+2Xu1EyOKvC5A9I+oCc+P6
|
31
|
+
LJqaMufUX9Qefm34ZBdgvqzn0AftvMjYIUOvbIU5uem017NSHD00bmH1xO4+Dxhh
|
32
|
+
ve3J+5FvPjgE54S29bbfgvMJRPNPpRf1kAxpHNmm4d+5QJRoIkFgwqr83jFW1w+l
|
33
|
+
5wuteMtb63Rh60vdtkMRexdlSWF0Tbns/otn0oLNTGDEjptmskS9Tt9asV+vy+38
|
34
|
+
gB5hvm0ZVOhWTupZAzI90V0KfVnVqfeBrXD+e+2LhQZPur7DKW6hJ7atyXoKnPGQ
|
35
|
+
wsJoMv/2Pxome92q2iZQ0ZEEV4DYM6tpetiC3sLMT70W5dBAck6YkUBfDlbRlrU1
|
36
|
+
a48r2r3b5G9dmbtyJVaowaxo
|
32
37
|
-----END CERTIFICATE-----
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
date: 2022-05-26 00:00:00.000000000 Z
|
39
|
+
dependencies:
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: random_word
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '2.1'
|
42
47
|
- - ">="
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
version:
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 2.1.1
|
45
50
|
type: :runtime
|
46
|
-
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '2.1'
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 2.1.1
|
47
60
|
description:
|
48
|
-
email:
|
61
|
+
email: digital.robertson@gmail.com
|
49
62
|
executables: []
|
50
|
-
|
51
63
|
extensions: []
|
52
|
-
|
53
64
|
extra_rdoc_files: []
|
54
|
-
|
55
|
-
files:
|
65
|
+
files:
|
56
66
|
- lib/leetpassword.rb
|
57
|
-
homepage:
|
58
|
-
licenses:
|
59
|
-
|
67
|
+
homepage: https://github.com/jrobertson/leetpassword
|
68
|
+
licenses:
|
69
|
+
- MIT
|
70
|
+
metadata: {}
|
60
71
|
post_install_message:
|
61
72
|
rdoc_options: []
|
62
|
-
|
63
|
-
require_paths:
|
73
|
+
require_paths:
|
64
74
|
- lib
|
65
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
-
|
67
|
-
requirements:
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
68
77
|
- - ">="
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version:
|
71
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
-
|
73
|
-
requirements:
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 2.1.2
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
74
82
|
- - ">="
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version:
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
77
85
|
requirements: []
|
78
|
-
|
79
|
-
rubyforge_project:
|
80
|
-
rubygems_version: 1.8.23
|
86
|
+
rubygems_version: 3.2.22
|
81
87
|
signing_key:
|
82
|
-
specification_version:
|
88
|
+
specification_version: 4
|
83
89
|
summary: leetpassword creates a password with 1 or 2 random leet words.
|
84
90
|
test_files: []
|
85
|
-
|
metadata.gz.sig
CHANGED
Binary file
|