ciri-utils 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +61 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ciri-utils.gemspec +28 -0
- data/lib/ciri/utils/logger.rb +99 -0
- data/lib/ciri/utils/number.rb +70 -0
- data/lib/ciri/utils/version.rb +5 -0
- data/lib/ciri/utils.rb +83 -0
- metadata +116 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: caed03d7633bd1969a1c30077108174620796d2f33aadd2535abb61e2794dacf
|
4
|
+
data.tar.gz: c099eb45fdeb30f8bc01083f5d55621c69397086736965c057558aef9e688d03
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bf6a784ed8c0bb566f8abe7f506e9a1cde5aabaf460a8fcdb1c44e2f8e702666fc66f67e07f4fd6edeb476135058bc6c81277b5f50984624c953c03f276eb9b8
|
7
|
+
data.tar.gz: 1698dad2effd4f3cb6aec338f318ce27a759b81df040004987d3567bc69cb1f877894c03112700e3ce8c3ed33675b4b63333b1e1ee630e475e0a033d9a99e5fe
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at jjyruby@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Jiang Jinyang
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Ciri::Utils
|
2
|
+
|
3
|
+
Toolkit module of [Ciri](https://github.com/ciri-ethereum/ciri)
|
4
|
+
|
5
|
+
Functions include: big endian encode/decode, hex/bytes convert, keccak256 ...
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'ciri-utils'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install ciri-utils
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
``` ruby
|
26
|
+
# keccak256
|
27
|
+
Ciri::Utils.sha3("...")
|
28
|
+
|
29
|
+
# secret_compare
|
30
|
+
Ciri::Utils.sha3(password, secret)
|
31
|
+
|
32
|
+
# convert between hex and bytes
|
33
|
+
Ciri::Utils.to_bytes("0x...")
|
34
|
+
Ciri::Utils.to_hex("\x00...")
|
35
|
+
|
36
|
+
# big endian encode and decode
|
37
|
+
Ciri::Utils.big_endian_encode(200)
|
38
|
+
Ciri::Utils.big_endian_decode("....")
|
39
|
+
|
40
|
+
# ....
|
41
|
+
```
|
42
|
+
|
43
|
+
See source code to find other methods.
|
44
|
+
|
45
|
+
## Development
|
46
|
+
|
47
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
48
|
+
|
49
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
50
|
+
|
51
|
+
## Contributing
|
52
|
+
|
53
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ciri-utils. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
54
|
+
|
55
|
+
## License
|
56
|
+
|
57
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
58
|
+
|
59
|
+
## Code of Conduct
|
60
|
+
|
61
|
+
Everyone interacting in the Ciri::Utils project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/ciri-utils/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ciri/utils"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/ciri-utils.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "ciri/utils/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "ciri-utils"
|
8
|
+
spec.version = Ciri::Utils::VERSION
|
9
|
+
spec.authors = ["Jiang Jinyang"]
|
10
|
+
spec.email = ["jjyruby@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Toolkit module of [Ciri](https://github.com/ciri-ethereum/ciri)}
|
13
|
+
spec.description = %q{Functions include: big endian encode/decode, hex/bytes convert, keccak256 ...}
|
14
|
+
spec.homepage = "https://github.com/ciri-ethereum/ciri"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_dependency 'digest-sha3', '~> 1.1.0'
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
28
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2018, by Jiang Jinyang. <https://justjjy.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
|
24
|
+
require 'logger'
|
25
|
+
|
26
|
+
module Ciri
|
27
|
+
module Utils
|
28
|
+
|
29
|
+
# Logger
|
30
|
+
# Example:
|
31
|
+
#
|
32
|
+
# class A
|
33
|
+
# include Logger
|
34
|
+
#
|
35
|
+
# def initialize(name)
|
36
|
+
# @name = name
|
37
|
+
# debug("initial with name")
|
38
|
+
# end
|
39
|
+
#
|
40
|
+
# def greet
|
41
|
+
# puts "hello"
|
42
|
+
# debug("greeting hello")
|
43
|
+
# end
|
44
|
+
#
|
45
|
+
# # customize logging name
|
46
|
+
# def logging_name
|
47
|
+
# "#{super}:#{@name}"
|
48
|
+
# end
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# # don't forget initialize global logger
|
52
|
+
# Ciri::Utils::Logger.setup(level: :debug)
|
53
|
+
#
|
54
|
+
module Logger
|
55
|
+
|
56
|
+
class << self
|
57
|
+
attr_reader :global_logger
|
58
|
+
|
59
|
+
def setup(level:)
|
60
|
+
@global_logger = ::Logger.new(STDERR, level: level)
|
61
|
+
global_logger.datetime_format = '%Y-%m-%d %H:%M:%S'
|
62
|
+
set_concurrent_logger(level: global_logger.level)
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def set_concurrent_logger(level:)
|
68
|
+
require 'concurrent'
|
69
|
+
Concurrent.use_simple_logger(level = level)
|
70
|
+
rescue LoadError
|
71
|
+
nil
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def debug(message)
|
76
|
+
add(::Logger::DEBUG, message)
|
77
|
+
end
|
78
|
+
|
79
|
+
def info(message)
|
80
|
+
add(::Logger::INFO, message)
|
81
|
+
end
|
82
|
+
|
83
|
+
def error(message)
|
84
|
+
add(::Logger::ERROR, message)
|
85
|
+
end
|
86
|
+
|
87
|
+
def logging_name
|
88
|
+
self.class.to_s
|
89
|
+
end
|
90
|
+
|
91
|
+
private
|
92
|
+
|
93
|
+
def add(severity, message = nil, progname = logging_name)
|
94
|
+
Logger.global_logger.add(severity, message, progname)
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2018, by Jiang Jinyang. <https://justjjy.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
|
24
|
+
module Ciri
|
25
|
+
module Utils
|
26
|
+
module Number
|
27
|
+
extend self
|
28
|
+
|
29
|
+
def big_endian_encode(n, zero = ''.b, size: nil)
|
30
|
+
b = big_endian_encode_raw(n, zero)
|
31
|
+
size.nil? ? b : b.rjust(size, "\x00".b)
|
32
|
+
end
|
33
|
+
|
34
|
+
def big_endian_decode(input)
|
35
|
+
input.each_byte.reduce(0) {|s, i| s * 256 + i}
|
36
|
+
end
|
37
|
+
|
38
|
+
UINT_256_MAX = 2 ** 256 - 1
|
39
|
+
UINT_256_CEILING = 2 ** 256
|
40
|
+
UINT_255_MAX = 2 ** 255 - 1
|
41
|
+
UINT_255_CEILING = 2 ** 255
|
42
|
+
|
43
|
+
def unsigned_to_signed(n)
|
44
|
+
n <= UINT_255_MAX ? n : n - UINT_256_CEILING
|
45
|
+
end
|
46
|
+
|
47
|
+
def signed_to_unsigned(n)
|
48
|
+
n >= 0 ? n : n + UINT_256_CEILING
|
49
|
+
end
|
50
|
+
|
51
|
+
def ceil_div(n, ceil)
|
52
|
+
size, m = n.divmod ceil
|
53
|
+
m.zero? ? size : size + 1
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def big_endian_encode_raw(n, zero = ''.b)
|
59
|
+
if n == 0
|
60
|
+
zero
|
61
|
+
elsif n > 0
|
62
|
+
big_endian_encode(n / 256) + (n % 256).chr
|
63
|
+
else
|
64
|
+
raise ArgumentError.new("can't encode negative number #{n}")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/ciri/utils.rb
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
require "ciri/utils/version"
|
2
|
+
|
3
|
+
require 'digest/sha3'
|
4
|
+
require_relative 'utils/number'
|
5
|
+
|
6
|
+
module Ciri
|
7
|
+
module Utils
|
8
|
+
|
9
|
+
class << self
|
10
|
+
include Utils::Number
|
11
|
+
|
12
|
+
|
13
|
+
def sha3(*data)
|
14
|
+
s = Digest::SHA3.new(256)
|
15
|
+
data.each {|i| s.update(i)}
|
16
|
+
s.digest
|
17
|
+
end
|
18
|
+
|
19
|
+
def secret_compare(s1, s2)
|
20
|
+
s1.size == s2.size && s1.each_byte.each_with_index.map {|b, i| b ^ s2[i].ord}.reduce(0, :+) == 0
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_bytes(hex)
|
24
|
+
hex = hex[2..-1] if hex.start_with?('0x')
|
25
|
+
[hex].pack("H*")
|
26
|
+
end
|
27
|
+
|
28
|
+
def hex_to_number(hex)
|
29
|
+
big_endian_decode to_bytes(hex)
|
30
|
+
end
|
31
|
+
|
32
|
+
def to_hex(data)
|
33
|
+
hex = data.to_s.unpack("H*").first
|
34
|
+
'0x' + hex
|
35
|
+
end
|
36
|
+
|
37
|
+
def number_to_hex(number)
|
38
|
+
to_hex big_endian_encode(number)
|
39
|
+
end
|
40
|
+
|
41
|
+
def create_ec_pk(raw_pubkey: nil, raw_privkey: nil)
|
42
|
+
public_key = raw_pubkey && begin
|
43
|
+
group = OpenSSL::PKey::EC::Group.new('secp256k1')
|
44
|
+
bn = OpenSSL::BN.new(raw_pubkey, 2)
|
45
|
+
OpenSSL::PKey::EC::Point.new(group, bn)
|
46
|
+
end
|
47
|
+
|
48
|
+
OpenSSL::PKey::EC.new('secp256k1').tap do |key|
|
49
|
+
key.public_key = public_key if public_key
|
50
|
+
key.private_key = OpenSSL::BN.new(raw_privkey, 2) if raw_privkey
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def to_underscore(str)
|
55
|
+
str.gsub(/[A-Z]/) {|a| "_" + a.downcase}
|
56
|
+
end
|
57
|
+
|
58
|
+
def blank_bytes?(item)
|
59
|
+
return true if item.is_a?(String) && item.each_byte.all?(&:zero?)
|
60
|
+
blank?(item)
|
61
|
+
end
|
62
|
+
|
63
|
+
def blank?(item)
|
64
|
+
if item.nil?
|
65
|
+
true
|
66
|
+
elsif item.is_a? Integer
|
67
|
+
item.zero?
|
68
|
+
elsif item.is_a? String
|
69
|
+
item.empty?
|
70
|
+
else
|
71
|
+
false
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def present?(item)
|
76
|
+
!blank?(item)
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
BLANK_SHA3 = Utils.sha3(''.b).freeze
|
82
|
+
end
|
83
|
+
end
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ciri-utils
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jiang Jinyang
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-07-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: digest-sha3
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.1.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.16'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.16'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
description: 'Functions include: big endian encode/decode, hex/bytes convert, keccak256
|
70
|
+
...'
|
71
|
+
email:
|
72
|
+
- jjyruby@gmail.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".travis.yml"
|
80
|
+
- CODE_OF_CONDUCT.md
|
81
|
+
- Gemfile
|
82
|
+
- LICENSE.txt
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- bin/console
|
86
|
+
- bin/setup
|
87
|
+
- ciri-utils.gemspec
|
88
|
+
- lib/ciri/utils.rb
|
89
|
+
- lib/ciri/utils/logger.rb
|
90
|
+
- lib/ciri/utils/number.rb
|
91
|
+
- lib/ciri/utils/version.rb
|
92
|
+
homepage: https://github.com/ciri-ethereum/ciri
|
93
|
+
licenses:
|
94
|
+
- MIT
|
95
|
+
metadata: {}
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options: []
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
requirements: []
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 2.7.3
|
113
|
+
signing_key:
|
114
|
+
specification_version: 4
|
115
|
+
summary: Toolkit module of [Ciri](https://github.com/ciri-ethereum/ciri)
|
116
|
+
test_files: []
|