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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a90a6f24240691ccdd65ca1185eeda32e95dfc65302d1eb4fa118a5b8e45504
4
- data.tar.gz: 463bf49ad884574607e5682bd00de52008fca4ee272e9a49f4723c846d306d1c
3
+ metadata.gz: 2e6d59497282552bfae629eb27790ab7052889936ed6cfe37b84ae34c308de1f
4
+ data.tar.gz: 79040059aad66e4eb6afaf2e6186b00017aeeed6697658960d7388768dc77f85
5
5
  SHA512:
6
- metadata.gz: 940795845301e0ca6c127c168b70b7731fbfba2c779a95bfacf56bdb830e3d1cedfbc79d95e846da41d558f763e7478402450c5fde7c5e24c524af6ef657d201
7
- data.tar.gz: e20d91623ec83339f47f662f83787af532146c77964f67aa59f52c9ff584ef0d49ca825f33f588d870b803fb90ac17d6b65e0ed1b0d6ece93ffbcb8563289300
6
+ metadata.gz: fdef30ff3536b8fcf72d9cbc2cca93793c2ac4a2802726e3c094d1c6b97ed7d35201dc392d9b4598d329aa31fe9240f84549975ef59cb1818ae95192072d8d20
7
+ data.tar.gz: ac5988d41745ce56cb3f071c104e2baa94b5adc0b0044f2188e8b3dd50c85b852af0e309149e66245f5d21d0ca0706b5f8466291c8654339ec6d14e4bfe26182
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- passweird (0.2.0)
4
+ passweird (0.2.1)
5
5
  activerecord (>= 7.0, < 8.0)
6
6
 
7
7
  GEM
@@ -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
- @possible_terms ||= all_substring_case_permutations.uniq
41
+ ([password] + substrings + unleeted_substrings).uniq
42
42
  end
43
43
 
44
44
  private
45
45
 
46
- def all_substring_case_permutations
47
- @all_substring_case_permutations ||= substrings + unleeted_substrings + downcased_substrings + upcased_substrings
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
@@ -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" => "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"
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.upcase.gsub(/[#{LEET_TO_ALPHABET.keys.join}]/, LEET_TO_ALPHABET)
120
+ given_string.gsub(/[#{LEET_TO_ALPHABET.keys.join}]/, LEET_TO_ALPHABET)
121
121
  end
122
122
  end
123
123
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Passweird
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passweird
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rupert Señga