zxcvbn 0.1.12 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3abba874325220873de3e16bf2213afe1e51c468e6c5059ee793641563bbd123
4
- data.tar.gz: e555337f55746d9fc2b2339797e287fb1a16c292d2d2b4aa54fdcfa0c7fbe370
3
+ metadata.gz: 13e1f178d40d7f161fe35df97e2c23ce212cb05862c35d3327528fb0126aed74
4
+ data.tar.gz: dea25dbbaa5c720b2459ca1b975a58382e532269763b4bd237ca698df6e53037
5
5
  SHA512:
6
- metadata.gz: ec032e5e93416aef8ea9526cc4ff39e90a381228965c718f50f0311f900c8c1029d1ad13b7efd88f79c3fa890e5fd0b6c61d3252131430e7f19b383e55e62767
7
- data.tar.gz: 5174f7aa4a0a65beefc790ea0f252abc749a203022b05d6b9ce33a6771599d6c41a33c2b341cda009eb0aad9d4d9df6da5b7cd308c2d3fb566657aafcecd0fab
6
+ metadata.gz: 57c31fb079bf00272779c04fe99db2586af5455ef8b92e0e2822210ffff0270636e816198dfcb266c7fc68f148d7c2426b9f159f29baeee9c8d442be8dc73419
7
+ data.tar.gz: ec33e3cb2187db01195a8158db1076e0517f7f9a15f7e76565ae3382114f49e17240724ca44261cc37dadc3ba2feb7c569a0d0b2e72c95627f316be9ebb2b32c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [0.1.13] - 2024-11-05
2
+ - [17] Optimize both allocated and retained memory usage
3
+
4
+ *zarqman (@zarqman)*
5
+
1
6
  ## [0.1.12] - 2024-10-29
2
7
  - [16] Stop using OpenStruct
3
8
 
@@ -13,7 +13,7 @@ module Zxcvbn
13
13
  f.each_line do |line|
14
14
  next if line.nil?
15
15
 
16
- main_enum << line.strip!
16
+ main_enum << line.strip!.freeze
17
17
  end
18
18
  end
19
19
  end
@@ -16,7 +16,7 @@ module Zxcvbn
16
16
  end
17
17
 
18
18
  RANKED_DICTIONARIES_MAX_WORD_SIZE = RANKED_DICTIONARIES.transform_values do |word_scores|
19
- word_scores.keys.max_by(&:size).size
19
+ word_scores.each_key.max_by(&:size)&.size || 0
20
20
  end
21
21
 
22
22
  GRAPHS = {
@@ -159,7 +159,7 @@ module Zxcvbn
159
159
  len = password.length
160
160
  password_lower = password.downcase
161
161
  longest_word_size = RANKED_DICTIONARIES_MAX_WORD_SIZE.fetch(dictionary_name) do
162
- ranked_dict.keys.max_by(&:size)&.size || 0
162
+ ranked_dict.each_key.max_by(&:size)&.size || 0
163
163
  end
164
164
  search_width = [longest_word_size, len].min
165
165
  (0...len).each do |i|
@@ -9,7 +9,7 @@ module Zxcvbn
9
9
  graph.each_value do |neighbors|
10
10
  average += neighbors.count { |n| n }.to_f
11
11
  end
12
- average /= graph.keys.size.to_f
12
+ average /= graph.size.to_f
13
13
  average
14
14
  end
15
15
 
@@ -324,8 +324,8 @@ module Zxcvbn
324
324
  # slightly different for keypad/mac keypad, but close enough
325
325
  KEYPAD_AVERAGE_DEGREE = calc_average_degree(ADJACENCY_GRAPHS["keypad"]).freeze
326
326
 
327
- KEYBOARD_STARTING_POSITIONS = ADJACENCY_GRAPHS["qwerty"].keys.size
328
- KEYPAD_STARTING_POSITIONS = ADJACENCY_GRAPHS["keypad"].keys.size
327
+ KEYBOARD_STARTING_POSITIONS = ADJACENCY_GRAPHS["qwerty"].size
328
+ KEYPAD_STARTING_POSITIONS = ADJACENCY_GRAPHS["keypad"].size
329
329
 
330
330
  def self.spatial_guesses(match)
331
331
  if ["qwerty", "dvorak"].include?(match["graph"])
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zxcvbn
4
- VERSION = "0.1.12"
4
+ VERSION = "0.1.13"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zxcvbn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael Santos
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-29 00:00:00.000000000 Z
11
+ date: 2024-11-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 100% native Ruby 100% compatible port of Dropbox's zxcvbn.js
14
14
  email:
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  - !ruby/object:Gem::Version
59
59
  version: '0'
60
60
  requirements: []
61
- rubygems_version: 3.5.11
61
+ rubygems_version: 3.5.16
62
62
  signing_key:
63
63
  specification_version: 4
64
64
  summary: ''