hashtastic 0.1.2 → 0.2.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 +5 -5
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/lib/hashtastic.rb +2 -0
- data/lib/hashtastic/dictionary_hasher.rb +23 -0
- data/lib/hashtastic/digester.rb +19 -0
- data/lib/hashtastic/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8a1e5b44ccfb59de465e29f03e25cb8d4f828b5b09074c0c8b96cbc826b51921
|
4
|
+
data.tar.gz: a9ccc452b9c6a67861224062c82d48ecc54c8acda26a1285d0696728cac0a886
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a0b7f8193c6e48fd2eeee598815ee8aa1c7416f101b3095e1536a96df0014b731e4ddc5a4b93c9f692d5387e59b63d026893bac62b1baff08ad4d990c921349
|
7
|
+
data.tar.gz: 8504b343d3a157f2d0e66c70393a1a243bf2a128db23485c942f238521ef6290f8e6c543b2c6496ae7309f0f2fa9c6f88767ee139470e30d976e0c5ff3af7c59
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
|
8
|
+
## [0.2.0] - 2019-07-17
|
9
|
+
### Added:
|
10
|
+
- DictionaryHasher function
|
11
|
+
|
7
12
|
## [0.1.2] - 2018-08-01
|
8
13
|
### Fixed:
|
9
14
|
- Yank gem
|
data/README.md
CHANGED
data/lib/hashtastic.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Hashtastic
|
4
|
+
class DictionaryHasher
|
5
|
+
class << self
|
6
|
+
def call(dictionary, filter = [])
|
7
|
+
encoded_message = Digester.call(dictionary, filter)
|
8
|
+
|
9
|
+
hasher = Digest::SHA3.new(256)
|
10
|
+
|
11
|
+
hasher.update(encoded_message)
|
12
|
+
|
13
|
+
hasher.hexdigest
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def extractor(dictionary, filter)
|
19
|
+
dictionary.with_indifferent_access.slice(*filter)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Hashtastic
|
4
|
+
class Digester
|
5
|
+
class << self
|
6
|
+
def call(dictionary, filter = [])
|
7
|
+
dictionary = filter.empty? ? dictionary : extractor(dictionary, filter)
|
8
|
+
|
9
|
+
URI.encode_www_form(dictionary.to_a.sort)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def extractor(dictionary, filter)
|
15
|
+
dictionary.with_indifferent_access.slice(*filter)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/hashtastic/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hashtastic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lucidity
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -128,7 +128,9 @@ files:
|
|
128
128
|
- bin/setup
|
129
129
|
- hashtastic.gemspec
|
130
130
|
- lib/hashtastic.rb
|
131
|
+
- lib/hashtastic/dictionary_hasher.rb
|
131
132
|
- lib/hashtastic/dictionary_values_hasher.rb
|
133
|
+
- lib/hashtastic/digester.rb
|
132
134
|
- lib/hashtastic/ethereum_sha3.rb
|
133
135
|
- lib/hashtastic/list_hasher.rb
|
134
136
|
- lib/hashtastic/version.rb
|
@@ -151,8 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
153
|
- !ruby/object:Gem::Version
|
152
154
|
version: '0'
|
153
155
|
requirements: []
|
154
|
-
|
155
|
-
rubygems_version: 2.6.8
|
156
|
+
rubygems_version: 3.0.3
|
156
157
|
signing_key:
|
157
158
|
specification_version: 4
|
158
159
|
summary: Utility hash functions.
|