secp256k1 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.simplecov +7 -0
- data/.travis.yml +11 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +63 -0
- data/LICENSE.txt +22 -0
- data/README.md +37 -0
- data/Rakefile +8 -0
- data/lib/secp256k1.rb +4 -0
- data/lib/secp256k1/ffi.rb +156 -0
- data/lib/secp256k1/version.rb +3 -0
- data/secp256k1.gemspec +29 -0
- data/spec/ffi_spec.rb +34 -0
- data/spec/spec_helper.rb +89 -0
- data/tasks/console.rake +0 -0
- data/tasks/default.rake +0 -0
- metadata +161 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ed5aeb96a787ac53fa813452088e963b3536c4a8
|
4
|
+
data.tar.gz: a66c09f100045eb9e744e41ebec65085b0ad7418
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e325b22289d809e56a1e5189651458616fe68bc367e1c280d5cc93886674cd5f5cf145f1148c14c9c0b732debc1904a909cc183c994e565d6a8ff6d50d4f6344
|
7
|
+
data.tar.gz: dd138a2c30a2ea578b499ee92799e205a0604293577180655f167b863ef4cea5ebe35164424657004cecd01832b6168c8897da99f3ce87d665f03b3eca0da132
|
data/.rspec
ADDED
data/.simplecov
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
secp256k1 (0.0.1)
|
5
|
+
ffi
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
coderay (1.1.0)
|
11
|
+
coveralls (0.7.2)
|
12
|
+
multi_json (~> 1.3)
|
13
|
+
rest-client (= 1.6.7)
|
14
|
+
simplecov (>= 0.7)
|
15
|
+
term-ansicolor (= 1.2.2)
|
16
|
+
thor (= 0.18.1)
|
17
|
+
diff-lcs (1.2.5)
|
18
|
+
docile (1.1.5)
|
19
|
+
ffi (1.9.6)
|
20
|
+
method_source (0.8.2)
|
21
|
+
mime-types (2.4.3)
|
22
|
+
multi_json (1.10.1)
|
23
|
+
pry (0.10.1)
|
24
|
+
coderay (~> 1.1.0)
|
25
|
+
method_source (~> 0.8.1)
|
26
|
+
slop (~> 3.4)
|
27
|
+
rake (10.4.2)
|
28
|
+
rest-client (1.6.7)
|
29
|
+
mime-types (>= 1.16)
|
30
|
+
rspec (3.1.0)
|
31
|
+
rspec-core (~> 3.1.0)
|
32
|
+
rspec-expectations (~> 3.1.0)
|
33
|
+
rspec-mocks (~> 3.1.0)
|
34
|
+
rspec-core (3.1.7)
|
35
|
+
rspec-support (~> 3.1.0)
|
36
|
+
rspec-expectations (3.1.2)
|
37
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
+
rspec-support (~> 3.1.0)
|
39
|
+
rspec-mocks (3.1.3)
|
40
|
+
rspec-support (~> 3.1.0)
|
41
|
+
rspec-support (3.1.2)
|
42
|
+
simplecov (0.9.1)
|
43
|
+
docile (~> 1.1.0)
|
44
|
+
multi_json (~> 1.0)
|
45
|
+
simplecov-html (~> 0.8.0)
|
46
|
+
simplecov-html (0.8.0)
|
47
|
+
slop (3.6.0)
|
48
|
+
term-ansicolor (1.2.2)
|
49
|
+
tins (~> 0.8)
|
50
|
+
thor (0.18.1)
|
51
|
+
tins (0.13.2)
|
52
|
+
|
53
|
+
PLATFORMS
|
54
|
+
ruby
|
55
|
+
|
56
|
+
DEPENDENCIES
|
57
|
+
bundler (~> 1.3)
|
58
|
+
coveralls
|
59
|
+
pry
|
60
|
+
rake
|
61
|
+
rspec
|
62
|
+
secp256k1!
|
63
|
+
simplecov
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Andy Alness and Micah Winkelspecht
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/GemHQ/secp256k1-rb.png)](https://travis-ci.org/GemHQ/secp256k1-rb) [![Coverage Status](https://img.shields.io/coveralls/GemHQ/secp256k1-rb.svg)](https://coveralls.io/r/GemHQ/secp256k1-rb?branch=master) [![Code Climate](https://codeclimate.com/github/GemHQ/secp256k1-rb.png)](https://codeclimate.com/github/GemHQ/secp256k1-rb) [![Gem Version](https://badge.fury.io/rb/secp256k1-rb.png)](http://badge.fury.io/rb/secp256k1-rb)
|
2
|
+
|
3
|
+
# Secp256k1: A ruby wrapper for libsecp256k1
|
4
|
+
|
5
|
+
This is a ruby wrapper for using libsecp256k1 in Ruby. The c library was originally written by Peter Wiulle for use in Bitcoin core libraries to replace OpenSSL for Bitcoin cryptographic functions.
|
6
|
+
This FFI wrapper was originally written by Andy Alness and gemified by Micah Winkelspecht.
|
7
|
+
|
8
|
+
## Installation instructions
|
9
|
+
|
10
|
+
You must first install libsecp256k1
|
11
|
+
|
12
|
+
````
|
13
|
+
$ brew install autoconf
|
14
|
+
$ brew install automake
|
15
|
+
$ brew install libtool
|
16
|
+
|
17
|
+
$ git clone git@github.com:bitcoin/secp256k1.git
|
18
|
+
$ cd secp256k1
|
19
|
+
|
20
|
+
$ ./autogem.sh
|
21
|
+
$ ./configure
|
22
|
+
$ make
|
23
|
+
$ sudo make install
|
24
|
+
|
25
|
+
````
|
26
|
+
|
27
|
+
Then install the secp256k1 gem:
|
28
|
+
|
29
|
+
````
|
30
|
+
$ gem install secp256k1
|
31
|
+
````
|
32
|
+
|
33
|
+
Or add this line to your Gemfile:
|
34
|
+
|
35
|
+
````
|
36
|
+
gem 'secp256k1'
|
37
|
+
````
|
data/Rakefile
ADDED
data/lib/secp256k1.rb
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
|
3
|
+
# Wraps libsecp256k1 (https://github.com/bitcoin/secp256k1)
|
4
|
+
module Secp256k1
|
5
|
+
require 'ffi'
|
6
|
+
extend ::FFI::Library
|
7
|
+
|
8
|
+
SECP256K1_START_VERIFY = (1 << 0)
|
9
|
+
SECP256K1_START_SIGN = (1 << 1)
|
10
|
+
|
11
|
+
# Load secp256k1 library and attach functions from C to Ruby via FFI.
|
12
|
+
def self.included(_base)
|
13
|
+
ffi_lib 'secp256k1'
|
14
|
+
attach_functions!
|
15
|
+
rescue LoadError => e
|
16
|
+
warn e.message
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.attach_functions!
|
20
|
+
attach_function :secp256k1_start, [:int], :void
|
21
|
+
attach_function :secp256k1_stop, [], :void
|
22
|
+
attach_function :secp256k1_ec_seckey_verify, [:pointer], :int
|
23
|
+
attach_function :secp256k1_ec_pubkey_create, [:pointer, :pointer, :pointer, :int], :int
|
24
|
+
attach_function :secp256k1_ecdsa_sign, [:pointer, :int, :pointer, :pointer, :pointer, :pointer], :int
|
25
|
+
attach_function :secp256k1_ecdsa_verify, [:pointer, :int, :pointer, :int, :pointer, :int], :int
|
26
|
+
attach_function :secp256k1_ecdsa_sign_compact, [:pointer, :int, :pointer, :pointer, :pointer, :pointer], :int
|
27
|
+
attach_function :secp256k1_ecdsa_recover_compact, [:pointer, :int, :pointer, :pointer, :pointer, :int, :int], :int
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.init
|
31
|
+
return if @secp256k1_started
|
32
|
+
secp256k1_start(SECP256K1_START_VERIFY | SECP256K1_START_SIGN)
|
33
|
+
@secp256k1_started = true
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.generate_key_pair(compressed=true)
|
37
|
+
init
|
38
|
+
|
39
|
+
while true do
|
40
|
+
priv_key = SecureRandom.random_bytes(32)
|
41
|
+
priv_key_buf = FFI::MemoryPointer.new(:uchar, 32)
|
42
|
+
priv_key_buf.put_bytes(0, priv_key)
|
43
|
+
break if secp256k1_ec_seckey_verify(priv_key_buf)
|
44
|
+
end
|
45
|
+
|
46
|
+
pub_key_buf = FFI::MemoryPointer.new(:uchar, 65)
|
47
|
+
pub_key_size = FFI::MemoryPointer.new(:int)
|
48
|
+
result = secp256k1_ec_pubkey_create(pub_key_buf, pub_key_size, priv_key_buf, compressed ? 1 : 0)
|
49
|
+
raise "error creating pubkey" unless result
|
50
|
+
|
51
|
+
[ priv_key, pub_key_buf.read_string(pub_key_size.read_int) ]
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.sign(data, priv_key)
|
55
|
+
init
|
56
|
+
|
57
|
+
data_buf = FFI::MemoryPointer.new(:uchar, data.bytesize)
|
58
|
+
data_buf.put_bytes(0, data)
|
59
|
+
|
60
|
+
sig_buf = FFI::MemoryPointer.new(:uchar, 72)
|
61
|
+
sig_size = FFI::MemoryPointer.new(:int)
|
62
|
+
sig_size.write_int(72)
|
63
|
+
|
64
|
+
priv_key_buf = FFI::MemoryPointer.new(:uchar, priv_key.bytesize)
|
65
|
+
priv_key_buf.put_bytes(0, priv_key)
|
66
|
+
|
67
|
+
while true do
|
68
|
+
nonce = FFI::MemoryPointer.new(:uchar, 32)
|
69
|
+
nonce.put_bytes(0, SecureRandom.random_bytes(32))
|
70
|
+
break if secp256k1_ecdsa_sign(data_buf, data.bytesize, sig_buf, sig_size, priv_key, nonce)
|
71
|
+
end
|
72
|
+
|
73
|
+
sig_buf.read_string(sig_size.read_int)
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.verify(data, signature, pub_key)
|
77
|
+
init
|
78
|
+
|
79
|
+
data_buf = FFI::MemoryPointer.new(:uchar, data.bytesize)
|
80
|
+
data_buf.put_bytes(0, data)
|
81
|
+
|
82
|
+
sig_buf = FFI::MemoryPointer.new(:uchar, signature.bytesize)
|
83
|
+
sig_buf.put_bytes(0, signature)
|
84
|
+
|
85
|
+
pub_key_buf = FFI::MemoryPointer.new(:uchar, pub_key.bytesize)
|
86
|
+
pub_key_buf.put_bytes(0, pub_key)
|
87
|
+
|
88
|
+
result = secp256k1_ecdsa_verify(data_buf, data.bytesize,
|
89
|
+
sig_buf, signature.bytesize,
|
90
|
+
pub_key_buf, pub_key.bytesize)
|
91
|
+
if result == -1
|
92
|
+
raise "error invalid pubkey"
|
93
|
+
elsif result == -2
|
94
|
+
raise "error invalid signature"
|
95
|
+
end
|
96
|
+
|
97
|
+
result == 1
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.sign_compact(message, priv_key, compressed=true)
|
101
|
+
init
|
102
|
+
|
103
|
+
message_buf = FFI::MemoryPointer.new(:uchar, message.bytesize)
|
104
|
+
message_buf.put_bytes(0, message)
|
105
|
+
|
106
|
+
sig_buf = FFI::MemoryPointer.new(:uchar, 64)
|
107
|
+
|
108
|
+
priv_key_buf = FFI::MemoryPointer.new(:uchar, priv_key.bytesize)
|
109
|
+
priv_key_buf.put_bytes(0, priv_key)
|
110
|
+
|
111
|
+
rec_id = FFI::MemoryPointer.new(:int)
|
112
|
+
|
113
|
+
while true do
|
114
|
+
nonce = FFI::MemoryPointer.new(:uchar, 32)
|
115
|
+
nonce.put_bytes(0, SecureRandom.random_bytes(32))
|
116
|
+
break if secp256k1_ecdsa_sign_compact(message_buf, message.bytesize, sig_buf, priv_key, nonce, rec_id)
|
117
|
+
end
|
118
|
+
|
119
|
+
header = [27 + rec_id.read_int + (compressed ? 4 : 0)].pack("C")
|
120
|
+
[ header, sig_buf.read_string(64) ].join
|
121
|
+
end
|
122
|
+
|
123
|
+
def self.recover_compact(message, signature)
|
124
|
+
init
|
125
|
+
|
126
|
+
return nil if signature.bytesize != 65
|
127
|
+
|
128
|
+
version = signature.unpack('C')[0]
|
129
|
+
return nil if version < 27 || version > 34
|
130
|
+
|
131
|
+
compressed = version >= 31 ? true : false
|
132
|
+
version -= 4 if compressed
|
133
|
+
rec_id = version - 27
|
134
|
+
|
135
|
+
message_buf = FFI::MemoryPointer.new(:uchar, message.bytesize)
|
136
|
+
message_buf.put_bytes(0, message)
|
137
|
+
|
138
|
+
signature[0] = ''
|
139
|
+
sig_buf = FFI::MemoryPointer.new(:uchar, signature.bytesize)
|
140
|
+
sig_buf.put_bytes(0, signature)
|
141
|
+
|
142
|
+
pub_key_len = compressed ? 33 : 65
|
143
|
+
pub_key_buf = FFI::MemoryPointer.new(:uchar, pub_key_len)
|
144
|
+
pub_key_size = FFI::MemoryPointer.new(:int)
|
145
|
+
pub_key_size.write_int(pub_key_len)
|
146
|
+
|
147
|
+
result = secp256k1_ecdsa_recover_compact(message_buf, message.bytesize,
|
148
|
+
sig_buf,
|
149
|
+
pub_key_buf, pub_key_size,
|
150
|
+
compressed ? 1 : 0,
|
151
|
+
rec_id)
|
152
|
+
return nil unless result
|
153
|
+
|
154
|
+
pub_key_buf.read_bytes(pub_key_size.read_int)
|
155
|
+
end
|
156
|
+
end
|
data/secp256k1.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'secp256k1/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "secp256k1"
|
8
|
+
spec.version = Secp256k1::VERSION
|
9
|
+
spec.authors = ["Andy Alness", "Micah Winkelspecht"]
|
10
|
+
spec.email = ["hello@gem.co"]
|
11
|
+
spec.description = %q{A Ruby Gem wrapper for libsecp256k1 by Peter Wiulle}
|
12
|
+
spec.summary = %q{A Ruby Gem wrapper for libsecp256k1 by Peter Wiulle}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "ffi"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "rspec"
|
26
|
+
spec.add_development_dependency "simplecov"
|
27
|
+
spec.add_development_dependency "coveralls"
|
28
|
+
spec.add_development_dependency "pry"
|
29
|
+
end
|
data/spec/ffi_spec.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
|
3
|
+
require_relative 'spec_helper.rb'
|
4
|
+
require 'secp256k1'
|
5
|
+
include Secp256k1
|
6
|
+
|
7
|
+
describe 'libsecp256k1' do
|
8
|
+
|
9
|
+
it 'sign and verify' do
|
10
|
+
priv, pub = Secp256k1.generate_key_pair
|
11
|
+
signature = Secp256k1.sign("derp", priv)
|
12
|
+
expect(Secp256k1.verify("derp", signature, pub)).to eql(true)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'sign compact and recover' do
|
16
|
+
priv, pub = Secp256k1.generate_key_pair
|
17
|
+
signature = Secp256k1.sign_compact("derp", priv)
|
18
|
+
expect(signature.bytesize).to eql(65)
|
19
|
+
pub2 = Secp256k1.recover_compact("derp", signature)
|
20
|
+
expect(pub2.bytesize).to eql(33)
|
21
|
+
expect(pub2).to eql(pub)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'sign compact and recover (uncompressed)' do
|
25
|
+
# uncompressed
|
26
|
+
priv, pub = Secp256k1.generate_key_pair(compressed=false)
|
27
|
+
signature = Secp256k1.sign_compact("derp", priv, compressed=false)
|
28
|
+
expect(signature.bytesize).to eql(65)
|
29
|
+
pub2 = Secp256k1.recover_compact("derp", signature)
|
30
|
+
expect(pub2.bytesize).to eql(65)
|
31
|
+
expect(pub2).to eql(pub)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
4
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
5
|
+
#
|
6
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
7
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
8
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
9
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
10
|
+
# a separate helper file that requires the additional dependencies and performs
|
11
|
+
# the additional setup, and require it from the spec files that actually need it.
|
12
|
+
#
|
13
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
14
|
+
# users commonly want.
|
15
|
+
#
|
16
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
17
|
+
RSpec.configure do |config|
|
18
|
+
# rspec-expectations config goes here. You can use an alternate
|
19
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
20
|
+
# assertions if you prefer.
|
21
|
+
config.expect_with :rspec do |expectations|
|
22
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
23
|
+
# and `failure_message` of custom matchers include text for helper methods
|
24
|
+
# defined using `chain`, e.g.:
|
25
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
26
|
+
# # => "be bigger than 2 and smaller than 4"
|
27
|
+
# ...rather than:
|
28
|
+
# # => "be bigger than 2"
|
29
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
30
|
+
end
|
31
|
+
|
32
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
33
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
34
|
+
config.mock_with :rspec do |mocks|
|
35
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
36
|
+
# a real object. This is generally recommended, and will default to
|
37
|
+
# `true` in RSpec 4.
|
38
|
+
mocks.verify_partial_doubles = true
|
39
|
+
end
|
40
|
+
|
41
|
+
# The settings below are suggested to provide a good initial experience
|
42
|
+
# with RSpec, but feel free to customize to your heart's content.
|
43
|
+
=begin
|
44
|
+
# These two settings work together to allow you to limit a spec run
|
45
|
+
# to individual examples or groups you care about by tagging them with
|
46
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
47
|
+
# get run.
|
48
|
+
config.filter_run :focus
|
49
|
+
config.run_all_when_everything_filtered = true
|
50
|
+
|
51
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
52
|
+
# For more details, see:
|
53
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
54
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
55
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
56
|
+
config.disable_monkey_patching!
|
57
|
+
|
58
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
59
|
+
# be too noisy due to issues in dependencies.
|
60
|
+
config.warnings = true
|
61
|
+
|
62
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
63
|
+
# file, and it's useful to allow more verbose output when running an
|
64
|
+
# individual spec file.
|
65
|
+
if config.files_to_run.one?
|
66
|
+
# Use the documentation formatter for detailed output,
|
67
|
+
# unless a formatter has already been configured
|
68
|
+
# (e.g. via a command-line flag).
|
69
|
+
config.default_formatter = 'doc'
|
70
|
+
end
|
71
|
+
|
72
|
+
# Print the 10 slowest examples and example groups at the
|
73
|
+
# end of the spec run, to help surface which specs are running
|
74
|
+
# particularly slow.
|
75
|
+
config.profile_examples = 10
|
76
|
+
|
77
|
+
# Run specs in random order to surface order dependencies. If you find an
|
78
|
+
# order dependency and want to debug it, you can fix the order by providing
|
79
|
+
# the seed, which is printed after each run.
|
80
|
+
# --seed 1234
|
81
|
+
config.order = :random
|
82
|
+
|
83
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
84
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
85
|
+
# test failures related to randomization by passing the same `--seed` value
|
86
|
+
# as the one that triggered the failure.
|
87
|
+
Kernel.srand config.seed
|
88
|
+
=end
|
89
|
+
end
|
data/tasks/console.rake
ADDED
File without changes
|
data/tasks/default.rake
ADDED
File without changes
|
metadata
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: secp256k1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andy Alness
|
8
|
+
- Micah Winkelspecht
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-12-08 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: ffi
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: bundler
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.3'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.3'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rspec
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: simplecov
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: coveralls
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: pry
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
description: A Ruby Gem wrapper for libsecp256k1 by Peter Wiulle
|
113
|
+
email:
|
114
|
+
- hello@gem.co
|
115
|
+
executables: []
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".rspec"
|
120
|
+
- ".simplecov"
|
121
|
+
- ".travis.yml"
|
122
|
+
- Gemfile
|
123
|
+
- Gemfile.lock
|
124
|
+
- LICENSE.txt
|
125
|
+
- README.md
|
126
|
+
- Rakefile
|
127
|
+
- lib/secp256k1.rb
|
128
|
+
- lib/secp256k1/ffi.rb
|
129
|
+
- lib/secp256k1/version.rb
|
130
|
+
- secp256k1.gemspec
|
131
|
+
- spec/ffi_spec.rb
|
132
|
+
- spec/spec_helper.rb
|
133
|
+
- tasks/console.rake
|
134
|
+
- tasks/default.rake
|
135
|
+
homepage: ''
|
136
|
+
licenses:
|
137
|
+
- MIT
|
138
|
+
metadata: {}
|
139
|
+
post_install_message:
|
140
|
+
rdoc_options: []
|
141
|
+
require_paths:
|
142
|
+
- lib
|
143
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
requirements: []
|
154
|
+
rubyforge_project:
|
155
|
+
rubygems_version: 2.4.1
|
156
|
+
signing_key:
|
157
|
+
specification_version: 4
|
158
|
+
summary: A Ruby Gem wrapper for libsecp256k1 by Peter Wiulle
|
159
|
+
test_files:
|
160
|
+
- spec/ffi_spec.rb
|
161
|
+
- spec/spec_helper.rb
|