passweird 0.2.0 → 0.2.1
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/passweird/checker.rb +3 -19
- data/lib/passweird/leet_speak.rb +17 -17
- data/lib/passweird/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e6d59497282552bfae629eb27790ab7052889936ed6cfe37b84ae34c308de1f
|
4
|
+
data.tar.gz: 79040059aad66e4eb6afaf2e6186b00017aeeed6697658960d7388768dc77f85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdef30ff3536b8fcf72d9cbc2cca93793c2ac4a2802726e3c094d1c6b97ed7d35201dc392d9b4598d329aa31fe9240f84549975ef59cb1818ae95192072d8d20
|
7
|
+
data.tar.gz: ac5988d41745ce56cb3f071c104e2baa94b5adc0b0044f2188e8b3dd50c85b852af0e309149e66245f5d21d0ca0706b5f8466291c8654339ec6d14e4bfe26182
|
data/Gemfile.lock
CHANGED
data/lib/passweird/checker.rb
CHANGED
@@ -38,33 +38,17 @@ module Passweird
|
|
38
38
|
#
|
39
39
|
# @return [Array<String>] an array of unique possible terms
|
40
40
|
def possible_terms
|
41
|
-
|
41
|
+
([password] + substrings + unleeted_substrings).uniq
|
42
42
|
end
|
43
43
|
|
44
44
|
private
|
45
45
|
|
46
|
-
def
|
47
|
-
@
|
48
|
-
end
|
49
|
-
|
50
|
-
def all_substrings
|
51
|
-
@all_substrings ||= (substrings + unleeted_substrings).uniq
|
46
|
+
def substrings
|
47
|
+
@substrings ||= Substringer.substrings(password.downcase)
|
52
48
|
end
|
53
49
|
|
54
50
|
def unleeted_substrings
|
55
51
|
@unleeted_substrings ||= LeetSpeak.unleet_all(substrings)
|
56
52
|
end
|
57
|
-
|
58
|
-
def substrings
|
59
|
-
@substrings ||= Substringer.substrings(password)
|
60
|
-
end
|
61
|
-
|
62
|
-
def downcased_substrings
|
63
|
-
@downcased_substrings ||= all_substrings.map(&:downcase)
|
64
|
-
end
|
65
|
-
|
66
|
-
def upcased_substrings
|
67
|
-
@upcased_substrings ||= all_substrings.map(&:upcase)
|
68
|
-
end
|
69
53
|
end
|
70
54
|
end
|
data/lib/passweird/leet_speak.rb
CHANGED
@@ -53,22 +53,22 @@ module Passweird
|
|
53
53
|
# Reference: https://en.wikipedia.org/wiki/Leet#Table_of_leet-speak_substitutes_for_normal_letters
|
54
54
|
# Excluded leet speak equivalents that has 3 or more characters
|
55
55
|
LEET_TO_ALPHABET = {
|
56
|
-
"4" => "
|
57
|
-
"8" => "
|
58
|
-
"(" => "
|
59
|
-
"3" => "
|
60
|
-
"ƒ" => "
|
61
|
-
"6" => "
|
62
|
-
"#" => "
|
63
|
-
"1" => "
|
64
|
-
"И" => "
|
65
|
-
"0" => "
|
66
|
-
"Я" => "
|
67
|
-
"5" => "
|
68
|
-
"7" => "
|
69
|
-
"พ" => "
|
70
|
-
"¥" => "
|
71
|
-
"2" => "
|
56
|
+
"4" => "a", "@" => "a", "Д" => "a",
|
57
|
+
"8" => "b", "ß" => "b",
|
58
|
+
"(" => "c", "{" => "c",
|
59
|
+
"3" => "e", "£" => "e", "€" => "e",
|
60
|
+
"ƒ" => "f",
|
61
|
+
"6" => "g", "9" => "g",
|
62
|
+
"#" => "h",
|
63
|
+
"1" => "i", "!" => "i",
|
64
|
+
"И" => "n", "ท" => "n",
|
65
|
+
"0" => "o", "Ø" => "o",
|
66
|
+
"Я" => "r",
|
67
|
+
"5" => "s", "$" => "s",
|
68
|
+
"7" => "t",
|
69
|
+
"พ" => "w", "₩" => "w", "ω" => "w",
|
70
|
+
"¥" => "y",
|
71
|
+
"2" => "z"
|
72
72
|
}.freeze
|
73
73
|
|
74
74
|
|
@@ -117,7 +117,7 @@ module Passweird
|
|
117
117
|
#
|
118
118
|
# @return [String] the converted normal text string
|
119
119
|
def unleet
|
120
|
-
given_string.
|
120
|
+
given_string.gsub(/[#{LEET_TO_ALPHABET.keys.join}]/, LEET_TO_ALPHABET)
|
121
121
|
end
|
122
122
|
end
|
123
123
|
end
|
data/lib/passweird/version.rb
CHANGED