h256 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +1 -1
  3. data/bin/h256 +1 -3
  4. data/lib/h256.rb +17 -3
  5. metadata +11 -136
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec713adbb28e42cdb64074afcf7e296104dc3eea08532eacba9b319333bf02f8
4
- data.tar.gz: 0222c40f099a637046aba379768776b375b8857099ad82bcfadd46fd93afb3b0
3
+ metadata.gz: b29dc7a5a19f2379a2b124a8dc1d0fbe04424bb7332ad25dc0eb7e8a9e65643a
4
+ data.tar.gz: 809d0d851f8bc86a5fc29040cfd1028fc107569615960ef0681e126cde3c1dc9
5
5
  SHA512:
6
- metadata.gz: fbde613e75c2007fc7135cd1c72e3f49a1b4e77da0d55e711cd91e4184a23d8b0a23e2410e94668ffd9112f94f19d3e3ebd1f3fac3141b5a468321ddc37ad2a8
7
- data.tar.gz: 57313d931b9417811de084a27f0812ee8a5844b1d8c58dfe0fe480282a9a289445ae135def5da94c5fd3cd2975c1077e75333ffa534a322d99815a458328aedb
6
+ metadata.gz: 0feb037ee2f23fae897bdb3dc28d05440ad700ca32b9fe78a69ffc853ffa72493083bc2a5502caed5e0350fa03ddbc20ed98d3fbf855662ef21848095270b8c6
7
+ data.tar.gz: 345be9bd1dadace291d7c55abb0eafbf11e91d8b78c3bf209699c1cd6fffeee9a5b241850d04079feabe0221ab9d9a09cbae855ccb57a460a5f3e9ac17b42c2a
data/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021 Cyril Kato
3
+ Copyright (c) 2021-2025 Cyril Kato
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/bin/h256 CHANGED
@@ -8,9 +8,7 @@ CONF_PATH = File.join(File.expand_path("~"), ".h256")
8
8
  unless File.exist?(CONF_PATH)
9
9
  print "Creating #{CONF_PATH} file... "
10
10
 
11
- File.open(CONF_PATH, "w") do |f|
12
- f.write("secret")
13
- end
11
+ File.write(CONF_PATH, "secret")
14
12
 
15
13
  File.chmod(600, CONF_PATH)
16
14
 
data/lib/h256.rb CHANGED
@@ -2,16 +2,30 @@
2
2
 
3
3
  require "digest/sha2"
4
4
 
5
- # H256 module.
5
+ # H256 module provides secure password hashing functionality using hex encoding
6
+ # @example
7
+ # builder = H256::Builder.new("my-secret-salt")
8
+ # hash = builder.call("my-password") # Returns a hex-encoded SHA-256 hash
6
9
  module H256
7
- # Builder class.
10
+ # Builder handles the creation of salted password hashes using SHA-256
11
+ # @example
12
+ # builder = H256::Builder.new("my-secret")
13
+ # hash = builder.call("p@ssw0rd") # => "a1b2c3d4..."
8
14
  class Builder
15
+ # @return [String] the secret salt used for hashing
9
16
  attr_reader :secret
10
17
 
18
+ # Initialize a new Builder with a secret salt
19
+ # @param secret [Object] the salt to use for hashing (will be converted to String)
11
20
  def initialize(secret)
12
- @secret = secret
21
+ @secret = String(secret)
22
+
23
+ freeze
13
24
  end
14
25
 
26
+ # Generate a hex-encoded salted hash of the provided value
27
+ # @param value [String] the value to hash
28
+ # @return [String] hex-encoded SHA-256 hash (64 characters)
15
29
  def call(value)
16
30
  ::Digest::SHA256.hexdigest("#{value}++#{secret}")
17
31
  end
metadata CHANGED
@@ -1,142 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: h256
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Kato
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2021-11-07 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: fix
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 1.0.0.beta8
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 1.0.0.beta8
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop-md
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rubocop-performance
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: rubocop-rake
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: rubocop-thread_safety
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: simplecov
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: yard
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- description: One-way SHA256 function with salt.
10
+ date: 2025-01-07 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: 'H256 reads its configuration from the ~/.h256 file at initialization.
13
+ This file, which should be readable by its owner only, have the salt value.
14
+
15
+ '
140
16
  email: contact@cyril.email
141
17
  executables:
142
18
  - h256
@@ -150,8 +26,8 @@ files:
150
26
  homepage: https://github.com/cyril/h256.rb
151
27
  licenses:
152
28
  - MIT
153
- metadata: {}
154
- post_install_message:
29
+ metadata:
30
+ rubygems_mfa_required: 'true'
155
31
  rdoc_options: []
156
32
  require_paths:
157
33
  - lib
@@ -159,15 +35,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
159
35
  requirements:
160
36
  - - ">="
161
37
  - !ruby/object:Gem::Version
162
- version: '3.0'
38
+ version: 3.1.0
163
39
  required_rubygems_version: !ruby/object:Gem::Requirement
164
40
  requirements:
165
41
  - - ">="
166
42
  - !ruby/object:Gem::Version
167
43
  version: '0'
168
44
  requirements: []
169
- rubygems_version: 3.2.22
170
- signing_key:
45
+ rubygems_version: 3.6.2
171
46
  specification_version: 4
172
47
  summary: One-way SHA256 function with salt.
173
48
  test_files: []